plugins decommissioned in sandbox :

- abbot
- castor
- hibernate
- j2ee
- jboss
- jbuilder
- jcoverage
- jetty
- jnlp
- release
- repository
- uberjar

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@377540 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
aheritier
2006-02-13 23:53:42 +00:00
parent af0c649fe1
commit 3289fd31ce
264 changed files with 0 additions and 28757 deletions

View File

@@ -1,385 +0,0 @@
<?xml version="1.0"?>
<!--
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
-->
<!--
========================================================================
Abbot plugin. Abbot is a GUI testing framework for AWT/Swing
applications.
========================================================================
-->
<project
xmlns:j="jelly:core"
xmlns:m="jelly:maven"
xmlns:x="jelly:xml"
xmlns:u="jelly:util"
xmlns:ant="jelly:ant"
xmlns:doc="doc"
xmlns:define="jelly:define"
xmlns:jsl="jelly:jsl">
<!--
========================================================================
Default goal. Execute the Abbot tests.
========================================================================
-->
<goal name="abbot" prereqs="abbot:test" description="Run the abbot tests"/>
<!--
========================================================================
Execute the Abbot tests by running the application locally.
========================================================================
-->
<goal name="abbot:test"
prereqs="abbot:check-env,abbot:prepare-filesystem,abbot:prepare-resources,java:compile,java:jar-resources"
description="Run the abbot tests">
<!-- Needed to define junit task -->
<taskdef name="junit"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
<classpath>
<pathelement location="${plugin.getDependencyPath('junit:junit')}"/>
</classpath>
</taskdef>
<!-- Just let JUnit execute the tests -->
<!-- IMPORTANT: We must fork the JUnit tests. Otherwise there are classpath
problems (the version of xerces in the Maven root CL seems to be the
cause). -->
<junit printSummary="${maven.abbot.printSummary}"
failureProperty="maven.test.failure" fork="true">
<!-- Sys properties -->
<setProperty name="dir" value="${maven.abbot.dir}" />
<sysproperty key="maven.abbot.src.dir" value="${maven.abbot.src.dir}"/>
<sysproperty key="basedir" value="${basedir}"/>
<u:tokenize var="listOfProperties" delim=" ">${maven.abbot.sysproperties}</u:tokenize>
<j:forEach var="someProperty" items="${listOfProperties}">
<sysproperty key="${someProperty}" value="${context.getVariable(someProperty)}"/>
</j:forEach>
<!-- JVM args -->
<u:tokenize var="listOfJvmArgs" delim=" ">${maven.abbot.jvmargs}</u:tokenize>
<j:forEach var="somejvmarg" items="${listOfJvmArgs}">
<jvmarg value="${somejvmarg}"/>
</j:forEach>
<!-- File format of test reports are defined here -->
<formatter type="xml"/>
<formatter type="${maven.abbot.format}" usefile="${maven.abbot.usefile}"/>
<!-- Classpath -->
<classpath>
<pathelement location="${plugin.dir}"/>
<pathelement location="${maven.build.dest}"/>
<pathelement location="${maven.test.dest}"/>
<j:forEach var="dep" items="${plugin.getDependencies()}">
<j:if test="${dep.getProperty('abbot.webstart')}">
<pathelement path="${plugin.getDependencyPath(dep.Id)}"/>
</j:if>
</j:forEach>
<j:forEach var="lib" items="${pom.artifacts}">
<pathelement path="${lib.path}"/>
</j:forEach>
</classpath>
<test name="${maven.abbot.include}" todir="${maven.abbot.reports.dir}"/>
</junit>
<!-- Junit exit status is stored in maven.test.failure. Whenever it is true
(and ignore flag is not) we must stop the build process -->
<j:if test="${maven.test.failure}">
<j:if test="${context.getVariable('maven.test.failure.ignore') != null}">
<fail message="There were test failures"/>
</j:if>
</j:if>
</goal>
<!--
========================================================================
Launch tests on a webstart application
========================================================================
-->
<goal name="abbot:test-webstart" prereqs="abbot:check-webstart-env,abbot:prepare-filesystem"
description="Launch tests on a webstart application">
<!-- First we get the remote jnlp -->
<get src="${maven.abbot.remotejnlp}"
dest="${maven.abbot.dest.dir}/${maven.abbot.webstart.jnlp.original}"/>
<!-- We make a jar with compiled main class -->
<!-- TODO: create this as part of the plugin creation and not as part of
its execution -->
<jar destfile="${maven.abbot.dest.jar.dir}/${maven.abbot.webstart.main.jar}"
basedir="${plugin.dir}" includes="**/*.class"/>
<!-- Iterating through dependencies, and signing them if they're not up-to-date -->
<j:if test="${context.getVariable('maven.abbot.sign')}">
<j:forEach var="dep" items="${plugin.getDependencies()}">
<j:if test="${dep.getProperty('abbot.webstart')}">
<j:set var="filename" value="${dep.GroupId}-${dep.ArtifactId}"/>
<j:set var="varname" value="abbot.signing.notrequired.${dep.id}"/>
<!-- Checking whether or not the dependency has to be signed -->
<uptodate property="${varname}"
srcfile="${plugin.getDependencyPath(dep.Id)}"
targetfile="${maven.abbot.dest.jar.dir}/${filename}.jar"/>
<!-- Keeping this debug trace a while to ensure that the up-to-date feature is working properly -->
<echo level="debug">${dep.id} is uptodate ? ${context.getVariable(varname) == true}</echo>
<!-- Signing the dependency only if it is not up-to-date or forced -->
<j:if test="${(context.getVariable(varname) != true)}">
<!-- Unsigning -->
<zip destfile="${maven.abbot.dest.jar.dir}/${filename}.jar">
<zipfileset src="${plugin.getDependencyPath(dep.id)}"
excludes="**/*.SF **/*.RSA **/*.DSA"/>
</zip>
<!-- Signing -->
<signjar jar="${maven.abbot.dest.jar.dir}/${filename}.jar"
keystore="${maven.abbot.sign.keystore}"
alias="${maven.abbot.sign.alias}"
storepass="${maven.abbot.sign.storepass}"/>
</j:if>
</j:if>
</j:forEach>
<!-- Also sign all user-specified extra jars to be added to the executing CP.
Note: The reason these jars are not passed as tagged dependencies is because
we need to be able to specify them from another plugin. -->
<u:tokenize var="customJars" delim=",">${maven.abbot.extrajars}</u:tokenize>
<j:forEach var="customJar" items="${customJars}">
<ant:basename property="jarname" file="${customJar}"/>
<copy todir="${maven.abbot.dest.jar.dir}" file="${customJar}"/>
<signjar jar="${maven.abbot.dest.jar.dir}/${jarname}"
keystore="${maven.abbot.sign.keystore}"
alias="${maven.abbot.sign.alias}"
storepass="${maven.abbot.sign.storepass}"/>
</j:forEach>
<!-- Jar containing abbot main class is signed -->
<!-- TODO: Only sign it if not already done instead of everytime -->
<signjar jar="${maven.abbot.dest.jar.dir}/${maven.abbot.webstart.main.jar}"
keystore="${maven.abbot.sign.keystore}"
alias="${maven.abbot.sign.alias}"
storepass="${maven.abbot.sign.storepass}"/>
</j:if>
<!-- Jnlp is modified so that local abbot libraries are referenced -->
<doc:jsl
input="${maven.abbot.dest.dir}/${maven.abbot.webstart.jnlp.original}"
output="${maven.abbot.webstart.jnlp.modified}"
outputDirectory="${maven.abbot.dest.dir}"
stylesheet="${plugin.resources}/jnlp.jsl"
outputMode="xml"
prettyPrint="true"/>
<!-- Java webstart is launched on local modified jnlp -->
<java classname="com.sun.javaws.Main" fork="true" failonerror="true">
<classpath>
<pathelement location="${maven.abbot.webstart.home}/javaws-l10n.jar"/>
<pathelement location="${maven.abbot.webstart.home}/javaws.jar"/>
</classpath>
<jvmarg value="-Djnlpx.home=${maven.abbot.webstart.home}"/>
<jvmarg value="-Djnlpx.heapsize=NULL,NULL"/>
<jvmarg value="-Djnlpx.jvm=${java.home}/bin/javaw.exe"/>
<jvmarg value="-Djnlpx.deployment.system.home=${maven.abbot.javaws.systemhome}"/>
<jvmarg value="-Djnlpx.deployment.user.home=${maven.abbot.javaws.userhome}"/>
<jvmarg value="-Djava.security.policy=${maven.abbot.webstart.home}/javaws.policy"/>
<jvmarg value="-DtrustProxy=true"/>
<arg value="${maven.abbot.dest.dir}/${maven.abbot.webstart.jnlp.modified}"/>
</java>
</goal>
<!--
========================================================================
Launch Abbot costello editor
========================================================================
-->
<goal name="abbot:editor" prereqs="abbot:check-env,abbot:prepare-filesystem"
description="Launch Abbot costello editor">
<!-- Launching abbot editor with abbot and jnlp dependencies as classpath -->
<java classname="abbot.editor.ScriptEditor" fork="true">
<classpath>
<!-- Abbot editor dependencies -->
<j:forEach var="dep" items="${plugin.getDependencies()}">
<j:if test="${dep.getProperty('abbot.editor')}">
<pathelement path="${plugin.getDependencyPath(dep.Id)}"/>
</j:if>
</j:forEach>
<path refid="maven.dependency.classpath"/>
</classpath>
</java>
</goal>
<!--
========================================================================
Launch Abbot costello editor on a webstart application
========================================================================
-->
<goal name="abbot:editor-webstart"
prereqs="abbot:check-webstart-env,abbot:prepare-filesystem"
description="Launch Abbot costello editor on a webstart application">
<!-- First we get the remote jnlp -->
<get src="${maven.abbot.remotejnlp}"
dest="${maven.abbot.dest.dir}/${maven.abbot.webstart.jnlp.original}"/>
<!-- Parsing jnlp file in order to copy all dependencies into local directory -->
<u:file var="inputFile" name="${maven.abbot.dest.dir}/${maven.abbot.webstart.jnlp.original}"/>
<x:parse var="parsedfile" xml="${inputFile}"/>
<x:set var="codebasename" select="string($parsedfile/jnlp/@codebase)"/>
<x:forEach var="jar" select="$parsedfile/jnlp/resources/jar">
<x:set var="jarname" select="string($jar/@href)"/>
<get src="${codebasename}/${jarname}" usetimestamp="true"
dest="${maven.abbot.dest.dir}/${jarname}"/>
</x:forEach>
<!-- Launching abbot editor with abbot and jnlp dependencies as classpath -->
<java classname="abbot.editor.ScriptEditor" fork="true">
<classpath>
<!-- Abbot editor dependencies -->
<j:forEach var="dep" items="${plugin.getDependencies()}">
<j:if test="${dep.getProperty('abbot.editor')}">
<pathelement path="${plugin.getDependencyPath(dep.Id)}"/>
</j:if>
</j:forEach>
<!-- Remote application dependencies -->
<x:forEach var="jar" select="$parsedfile/jnlp/resources/jar">
<x:set var="jarname" select="string($jar/@href)"/>
<pathelement path="${maven.abbot.dest.dir}/${jarname}"/>
</x:forEach>
<!-- Extra dependencies -->
<u:tokenize var="customJars" delim=",">${maven.abbot.extrajars}</u:tokenize>
<j:forEach var="customJar" items="${customJars}">
<pathelement location="${customjar}"/>
</j:forEach>
</classpath>
</java>
</goal>
<!--
========================================================================
Copy test resources to test directory (internal goal)
========================================================================
-->
<goal name="abbot:prepare-resources" prereqs="abbot:prepare-filesystem">
<j:if test="${pom.build.unitTest != null}">
<j:if test="${!pom.build.unitTest.resources.isEmpty()}">
<m:copy-resources
resources="${pom.build.unitTest.resources}"
todir="${maven.test.dest}"/>
</j:if>
</j:if>
</goal>
<!--
========================================================================
Create needed directories (internal goal)
========================================================================
-->
<goal name="abbot:prepare-filesystem">
<mkdir dir="${maven.test.dest}"/>
<mkdir dir="${maven.abbot.reports.dir}"/>
<mkdir dir="${maven.abbot.dest.dir}"/>
<mkdir dir="${maven.abbot.dest.jar.dir}"/>
</goal>
<!--
========================================================================
Checking environment (internal goal)
========================================================================
-->
<goal name="abbot:check-env">
<j:if test="${context.getVariable('java.awt.headless') == true}">
<fail message="Abbot plugin cannot be used in awt headless environment"/>
</j:if>
</goal>
<!--
========================================================================
Checking webstart environment (internal goal)
========================================================================
-->
<goal name="abbot:check-webstart-env" prereqs="abbot:check-env">
<u:file var="webstartHomeAsFile" name="${maven.abbot.webstart.home}"/>
<j:if test="${!webstartHomeAsFile.exists()}">
<fail>Webstart home directory not found at [${maven.abbot.webstart.home}]</fail>
</j:if>
<j:if test="${context.getVariable('maven.abbot.sign') == false}">
<fail>In the current version the Abbot plugin only works when signing jars</fail>
</j:if>
<j:if test="${context.getVariable('maven.abbot.remotejnlp') == null}">
<fail>Mandatory variable maven.abbot.remotejnlp is missing</fail>
</j:if>
<j:if test="${context.getVariable('maven.abbot.javaws.systemhome') == null}">
<fail>Mandatory variable maven.abbot.javaws.systemhome is missing</fail>
</j:if>
<j:if test="${context.getVariable('maven.abbot.javaws.userhome') == null}">
<fail>Mandatory variable maven.abbot.javaws.userhome is missing</fail>
</j:if>
</goal>
<!--
========================================================================
Dependency handle so that other plugins can load this plugin and its
properties. This is especially useful if another plugin needs to
modify one property of the Abbot plugin.
========================================================================
-->
<define:taglib uri="abbot">
<define:tag name="dependency-handle">
<!-- Use this tag to allow this plugin to be loaded into another -->
<echo>DEPRECATED: the use of dependency-handle is deprecated. Please use maven:get/set to modify properties of the abbot plugin</echo>
</define:tag>
</define:taglib>
</project>

View File

@@ -1,101 +0,0 @@
# -------------------------------------------------------------------
# Copyright 2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# Properties required for all the abbot plugin goals
# -------------------------------------------------------------------
# Location of abbot source scripts
maven.abbot.src.dir = ${maven.src.dir}/abbot
# (optional) Explicit comma-separated list of Abbot source scripts
# to execute. If not defined, the plugin will execute all .xml files
# located in maven.abbot.src.dir
# maven.abbot.src.files =
# Decide whether or not to recurse in maven.abbot.src.dir to find
# Abbot .xml source scripts.
maven.abbot.recurse = true
# Location where the abbot plugin puts build files related to abbot
maven.abbot.dest.dir = ${maven.build.dir}/abbot
# Location where the abbot plugin signs the jars to be added to the
# generated JNLP file.
maven.abbot.dest.jar.dir = ${maven.abbot.dest.dir}/jars
# Location where abbot junit test results will be located
maven.abbot.reports.dir = ${maven.build.dir}/abbot-reports
maven.abbot.printSummary = ${maven.junit.printSummary}
maven.abbot.dir = ${maven.junit.dir}
maven.abbot.sysproperties = ${maven.junit.sysproperties}
maven.abbot.jvmargs = ${maven.junit.jvmargs}
maven.abbot.format = ${maven.junit.format}
maven.abbot.usefile = ${maven.junit.usefile}
# (optional) Name of the test suite beeing executed. This name will be used
# to name the generated JUnit test report. If not specified the report name
# will be TEST-org.apache.maven.abbot.AbbotTestAll. This is useful when
# you're calling the Abbot plugin several times in a row as otherwise the
# reports will overwrite each other.
#maven.abbot.suite.name = MyTestSuite
# Decide whether to turn on webstart debugging.
maven.abbot.debug = false
# -------------------------------------------------------------------
# Properties required only for the abbot:test goal
# -------------------------------------------------------------------
# Name of the JUnit test to execute that will trigger the execution
# of the Abbot scripts. This name should not be changed unless you
# want to provide your own Abbot script wrapper.
maven.abbot.include = org.apache.maven.abbot.AbbotTestAll
# -------------------------------------------------------------------
# Properties required only for the abbot:test-webstart goal
# -------------------------------------------------------------------
# The following properties are mandatories. They depend on your
# execution environment and must be set in your build.properties file
# or equivalent:
#
# - maven.abbot.remotejnlp: This property points to the JNLP file of
# the application you're testing.
# - maven.abbot.javaws.systemhome: Java webstart system cache location
# - maven.abbot.javaws.userhome: Java webstart user cache location
# Location of webstart executable. Override if your install does not match
# this default location
maven.abbot.webstart.home = ${java.home}/javaws
# TODO: Remove these 4 properties as I don't see any use case associated with them
maven.abbot.webstart.jnlp.original = original.jnlp
maven.abbot.webstart.jnlp.modified = modified.jnlp
maven.abbot.webstart.main.jar = abbot-main.jar
maven.abbot.webstart.main.class = org.apache.maven.abbot.AbbotWebstartTestRunner
# Note: For now we only support signing jars. The reason is that we need
# to add the Abbot jars to the JNLP file and as we're taking these jars
# from the local file system we need to have the permissions and thus we
# need signed jars to get these permissions.
maven.abbot.sign = true
# Extra list of jars (separated by commas) to be added to the generated JNLP
# and to the executing CP for the editor goal. This is useful for example when
# creating custom Abbot testers that need to be included in the executing CP.
#maven.abbot.extrajars =

View File

@@ -1,24 +0,0 @@
# -------------------------------------------------------------------
# Copyright 2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
maven.abbot.reports.dir = ${maven.build.dir}
# WARNING: By default, do not run unit tests as they require a display
# and a display may not be available on build server.
maven.test.skip = true
# Have the abbot test reports appear in ${maven.abbot.reports.dir}
maven.junit.sysproperties = maven.abbot.reports.dir

View File

@@ -1,155 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project xmlns="http://maven.apache.org/POM/3.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/3.0.0 http://maven.apache.org/maven-v3_0_0.xsd">
<extend>../plugins-parent/project.xml</extend>
<pomVersion>3</pomVersion>
<id>maven-abbot-plugin</id>
<name>Maven Abbot Plugin</name>
<currentVersion>1.2-SNAPSHOT</currentVersion>
<description>Run Abbot tests</description>
<shortDescription>Abbot Tests</shortDescription>
<versions>
<version>
<id>1.0</id>
<name>1.0</name>
<tag>MAVEN_ABBOT_1_0</tag>
</version>
<version>
<id>1.1</id>
<name>1.1</name>
<tag>MAVEN_ABBOT_1_1</tag>
</version>
</versions>
<developers>
<developer>
<name>Vincent Massol</name>
<id>vmassol</id>
<email>vmassol@pivolis.com</email>
<organization>Pivolis</organization>
<roles>
<role>Creator</role>
<role>Java Developer</role>
<role>Release Manager</role>
</roles>
</developer>
<developer>
<name>Christian Blavier</name>
<id>cblavier</id>
<email>cblavier@octo.com</email>
<organization>Octo Technology</organization>
<roles>
<role>Creator</role>
<role>Java Developer</role>
</roles>
</developer>
</developers>
<contributors/>
<dependencies>
<dependency>
<groupId>abbot</groupId>
<artifactId>abbot</artifactId>
<version>0.13.0</version>
<properties>
<abbot.editor>true</abbot.editor>
<abbot.webstart>true</abbot.webstart>
</properties>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0</version>
<properties>
<abbot.editor>true</abbot.editor>
<abbot.webstart>true</abbot.webstart>
</properties>
</dependency>
<!-- Required for the Costello editor -->
<dependency>
<groupId>mrj</groupId>
<artifactId>MRJToolkitStubs</artifactId>
<version>1.0</version>
<properties>
<abbot.editor>true</abbot.editor>
</properties>
</dependency>
<dependency>
<groupId>gnu-regexp</groupId>
<artifactId>gnu-regexp</artifactId>
<version>1.1.4</version>
<properties>
<abbot.editor>true</abbot.editor>
</properties>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<properties>
<abbot.editor>true</abbot.editor>
<abbot.webstart>true</abbot.webstart>
</properties>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.6.2</version>
<properties>
<abbot.editor>true</abbot.editor>
<abbot.webstart>true</abbot.webstart>
</properties>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xmlParserAPIs</artifactId>
<version>2.6.2</version>
<properties>
<abbot.editor>true</abbot.editor>
<abbot.webstart>true</abbot.webstart>
</properties>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>1.6.5</version>
<properties>
<abbot.webstart>true</abbot.webstart>
<comment>Overriden by the release of this library bundled in the core of maven and already loaded in the root classloader.</comment>
</properties>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-junit</artifactId>
<version>1.6.5</version>
<properties>
<abbot.webstart>true</abbot.webstart>
<comment>Overriden by the release of this library bundled in the core of maven and already loaded in the root classloader.</comment>
</properties>
</dependency>
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-xml</artifactId>
<version>1.1</version>
<url>http://jakarta.apache.org/commons/jelly/libs/xml/</url>
<properties>
<comment>This library is already loaded by maven's core. Be careful to use the same version number as in the core.</comment>
</properties>
</dependency>
</dependencies>
</project>

View File

@@ -1,127 +0,0 @@
package org.apache.maven.abbot;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import junit.extensions.abbot.ScriptFixture;
import junit.extensions.abbot.ScriptTestSuite;
import junit.framework.Test;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
/**
* TestAll is the entry point for all Abbot functional tests.
* It executes all xml files located in the passed src/abbot/ dir.
*/
public class AbbotTestAll extends ScriptFixture
{
/**
* Location of Abbot scripts
*/
private static final String TESTPATH =
System.getProperty("maven.abbot.src.dir");
/**
* Should we recurse in the directory where Abbot scripts are located?
*/
private static final boolean RECURSE =
Boolean.getBoolean("maven.abbot.recurse");
/**
* Custom ScriptTestSuite to only accept xml files.
*/
public static class MavenScriptTestSuite extends ScriptTestSuite
{
public MavenScriptTestSuite(Class fixtureClass, String dirName,
boolean recurse)
{
super(fixtureClass, dirName, recurse);
}
public MavenScriptTestSuite(Class fixtureClass, String[] filenames)
{
super(fixtureClass, filenames);
}
public boolean accept(File file)
{
return file.getName().endsWith(".xml");
}
}
/**
* Return test suite containing all scripts.
*/
public static Test suite()
{
MavenScriptTestSuite suite;
String[] files = getScriptFileNames();
if (files == null)
{
suite = new MavenScriptTestSuite(ScriptFixture.class, TESTPATH,
RECURSE);
}
else
{
suite = new MavenScriptTestSuite(ScriptFixture.class, files);
}
return suite;
}
/**
* @see ScriptFixture#ScriptFixture(java.lang.String)
*/
public AbbotTestAll(String name)
{
super(name);
}
/**
* @return the file list (as a String array) specified by the optional
* <code>maven.abbot.src.files</code> Maven property or null
* if the property is not defined. Also returns null if there
* are no files defined in the <code>maven.abbot.src.files</code>
* property.
*/
protected static String[] getScriptFileNames()
{
String files = System.getProperty("maven.abbot.src.files");
String[] result = null;
if (files != null)
{
List fileList = new ArrayList();
StringTokenizer st = new StringTokenizer(files, ",");
while (st.hasMoreTokens())
{
fileList.add(st.nextToken());
}
if (!fileList.isEmpty())
{
result = (String[]) fileList.toArray(new String[0]);
}
}
return result;
}
}

View File

@@ -1,158 +0,0 @@
package org.apache.maven.abbot;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.io.File;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.optional.junit.FormatterElement;
import org.apache.tools.ant.taskdefs.optional.junit.JUnitTask;
import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest;
/**
* Proxy for testing webstart application with Abbot. It replaces the main
* class of the application to test and uses the JUnit Ant task test runner
* to execute the Abbot tests. In order to use this class, it must be
* referenced as the main class in the JNLP file.
*
* @version $Id$
*/
public class AbbotWebstartTestRunner
{
/**
* Name of the generic TestCase to execute. That test will execute all the
* XML Abbot scripts.
*/
private static final String GENERIC_TEST = AbbotTestAll.class.getName();
/**
* Directory where junit reports are to be generated.
*/
private static final String REPORT_DIR =
System.getProperty("maven.abbot.reports.dir", "");
/**
* Name given by the user to the suite of tests being executed. The Abbot
* test report will be name after the content of this property. This is
* useful when you're calling the Abbot plugin several times in a row as
* otherwise the reports will overwrite each other.
*/
private static final String TESTSUITE_NAME =
System.getProperty("maven.abbot.suite.name");
/**
* Entry point for starting the Ant JUnit test runner which will start
* all our Abbot script tests.
*
* @param args the parameters that we need to use to start the Ant test
* runner
* @throws Exception in case of unanticipated error
*/
public static void main(String[] args) throws Exception
{
AbbotWebstartTestRunner main = new AbbotWebstartTestRunner();
main.execute(GENERIC_TEST, REPORT_DIR);
}
/**
* Execute the JUnit test runner using the Ant JUnitTask task.
*
* Note: We absolutely need to call System.exit() as all webstart
* applications are required to do so. This is required for the
* application to close at the end of the tests
* (see http://www.vamphq.com/jwsfaq.html#linger).
*
* @param testName the name of the generic test that will in turn run all
* the Abbot XML scripts
* @param reportdir directory where junit reports are to be generated
* @throws Exception in case of unanticipated error
*/
public void execute(String testName, String reportDir)
{
try
{
executeAntJunitTestRunner(testName, reportDir);
System.exit(0);
}
catch (Throwable t)
{
System.exit(1);
}
}
/**
* Execute the JUnit test runner using the Ant JUnitTask task.
*
* @param testName the name of the generic test that will in turn run all
* the Abbot XML scripts
* @param reportdir directory where junit reports are to be generated
* @throws Exception in case of unanticipated error
*/
private void executeAntJunitTestRunner(String testName, String reportDir)
throws Exception
{
Project project = new Project();
project.init();
JUnitTask junit = new JUnitTask();
junit.setProject(project);
// Do not fork so that we use the same classpath that was used to
// start this class.
junit.setFork(false);
// Set properties of the JUnit Ant task
// Set formatter
junit.addFormatter(createFormatterElement("xml"));
junit.addFormatter(createFormatterElement("plain"));
// Add tests to run
JUnitTest test = new JUnitTest(testName);
test.setTodir(new File(reportDir));
// Sets the name of the report file is the user has specified a name.
// Otherwise the name of the AbbotTestAll class will be used.
if (TESTSUITE_NAME != null)
{
test.setOutfile(TESTSUITE_NAME);
}
junit.addTest(test);
// Other settings
junit.setHaltonerror(true);
junit.setHaltonfailure(true);
// Execute the task...
junit.execute();
}
/**
* @param type the formatter type ("xml", "plain" or "brief")
* @return a properly set {@link FormatterElement} object
*/
private FormatterElement createFormatterElement(String type)
{
FormatterElement formatterElement = new FormatterElement();
FormatterElement.TypeAttribute typeAttribute =
new FormatterElement.TypeAttribute();
typeAttribute.setValue(type);
formatterElement.setType(typeAttribute);
return formatterElement;
}
}

View File

@@ -1,134 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
-->
<jsl:stylesheet
select="$doc"
xmlns:j="jelly:core"
xmlns:jsl="jelly:jsl"
xmlns:x="jelly:xml"
xmlns:u="jelly:util"
xmlns:ant="jelly:ant"
xmlns:doc="doc"
xmlns="dummy"
trim="true">
<!-- Entry point (first matching template) -->
<jsl:template match="/jnlp">
<x:element name="jnlp">
<x:attribute name="spec"> <x:expr select="@spec"/> </x:attribute>
<x:attribute name="codebase"> <x:expr select="@codebase"/> </x:attribute>
<jsl:applyTemplates select="//information"/>
<jsl:applyTemplates select="//security"/>
<jsl:applyTemplates select="//resources"/>
<jsl:applyTemplates select="//application-desc"/>
</x:element>
</jsl:template>
<!-- Copy information data "as-is" -->
<jsl:template match="information">
<x:copyOf select="."/>
</jsl:template>
<!-- Copy security data "as-is" -->
<jsl:template match="security">
<x:copyOf select="."/>
</jsl:template>
<!-- Transform jnlp resources -->
<jsl:template match="resources">
<resources>
<!-- Copy j2se anchor -->
<x:copyOf select="j2se"/>
<!-- Copy the former "main jar" reference, without main attribute -->
<jsl:applyTemplates select="jar[@main]"/>
<!-- Copy all the other jars references -->
<x:copyOf select="jar[not(@main)]"/>
<!-- Add references to all jars found in the ${maven.abbot.dest.jar.dir} dir -->
<ant:fileScanner var="scanner">
<ant:fileset dir="${maven.abbot.dest.jar.dir}" includes="*.jar"/>
</ant:fileScanner>
<j:forEach var="jar" items="${scanner.iterator()}">
<x:element name="jar">
<!-- Treat "main" jar differently -->
<j:if test="${jar.name == context.getVariable('maven.abbot.webstart.main.jar')}">
<x:attribute name="main">true</x:attribute>
</j:if>
<x:attribute name="href">file:${jar.absolutePath}</x:attribute>
</x:element>
</j:forEach>
<!-- Copy all existing sys properties -->
<x:copyOf select="property"/>
<!-- Add some other properties -->
<x:element name="property">
<x:attribute name="name">maven.abbot.src.dir</x:attribute>
<x:attribute name="value">${maven.abbot.src.dir}</x:attribute>
</x:element>
<j:if test="${context.getVariable('maven.abbot.src.files') != null}">
<x:element name="property">
<x:attribute name="name">maven.abbot.src.files</x:attribute>
<x:attribute name="value">${maven.abbot.src.files}</x:attribute>
</x:element>
</j:if>
<x:element name="property">
<x:attribute name="name">maven.abbot.reports.dir</x:attribute>
<x:attribute name="value">${maven.abbot.reports.dir}</x:attribute>
</x:element>
<j:if test="${context.getVariable('maven.abbot.suite.name') != null}">
<x:element name="property">
<x:attribute name="name">maven.abbot.suite.name</x:attribute>
<x:attribute name="value">${maven.abbot.suite.name}</x:attribute>
</x:element>
</j:if>
<!-- Add debug properties if debug mode is turned on -->
<j:if test="${maven.abbot.debug}">
<!-- Note: For some unknown reason, adding the "+TraceSecurity" option
hangs Java Web Start (at least on 1.4.2_01) -->
<property name="javaws.debug.0" value="+TraceCache"/>
<property name="javaws.debug.1" value="+TraceDiskCache"/>
<property name="javaws.debug.2" value="+TraceDownload"/>
<property name="javaws.debug.3" value="+TraceXMLParsing"/>
</j:if>
</resources>
</jsl:template>
<!-- Copy jar anchor without its main attribute -->
<jsl:template match="jar[@main]">
<x:element name="jar">
<x:attribute name="href"> <x:expr select="@href"/> </x:attribute>
</x:element>
</jsl:template>
<!-- Change the main class -->
<jsl:template match="application-desc">
<application-desc main-class="${maven.abbot.webstart.main.class}">
</application-desc>
</jsl:template>
</jsl:stylesheet>

View File

@@ -1,19 +0,0 @@
<?xml version="1.0"?>
<project xmlns:j="jelly:core" xmlns:maven="jelly:maven">
<goal name="testPlugin">
<echo>This plugin must be tested manually (with the testPlugin-manual goal) as it requires defining a build.properties containing environment-dependent configuration.</echo>
</goal>
<!-- Note: We're not naming this goal testPlugin voluntarily. The
reason is that in order for the test to run fine, the user must
create a build.properties file in sample-webstart. The test also
runs only on windows for now, WebStart must be installed and some
environment variable must be set. -->
<goal name="testPlugin-manual">
<maven:reactor basedir="${basedir}" includes="*/project.xml" goals="dist" banner="Test" ignoreFailures="false"/>
</goal>
</project>

View File

@@ -1,41 +0,0 @@
<?xml version="1.0"?>
<project>
<pomVersion>3</pomVersion>
<groupId>maven</groupId>
<currentVersion>1.0</currentVersion>
<url>http://maven.apache.org/maven-1.x/reference/plugins/abbot/</url>
<issueTrackingUrl>http://jira.codehaus.org/BrowseProject.jspa?id=xxxxx</issueTrackingUrl>
<siteDirectory>/www/maven.apache.org/maven-1.x/reference/plugins/abbot/</siteDirectory>
<repository>
<connection>scm:svn:http://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk/abbot/</connection>
<url>http://svn.apache.org/viewcvs.cgi/maven/maven-1/plugins/trunk/abbot/</url>
</repository>
<developers>
<developer>
<name>Christian Blavier</name>
<id>cblavier</id>
<email>christian.blavier@bnpparibas.fr</email>
<organization>BNP Paribas</organization>
<roles>
<role>Creator</role>
<role>Java Developer</role>
<role>Lead Developer</role>
</roles>
</developer>
<developer>
<name>Vincent Massol</name>
<id>vmassol</id>
<email>vmassol@pivolis.com</email>
<organization>Pivolis</organization>
<roles>
<role>Creator</role>
<role>Java Developer</role>
<role>Release Manager</role>
<role>Lead Developer</role>
</roles>
</developer>
</developers>
<build>
<sourceDirectory>${basedir}/src/java</sourceDirectory>
</build>
</project>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0"?>
<project xmlns:ant="jelly:ant">
<postGoal name="jar:jar">
<ant:signjar jar="${maven.build.dir}/${maven.final.name}.jar"
keystore="${maven.abbot.sign.keystore}"
storepass="${maven.abbot.sign.storepass}"
alias="${maven.abbot.sign.alias}"/>
</postGoal>
<goal name="dist" prereqs="jar:install,abbot:test"/>
</project>

View File

@@ -1,23 +0,0 @@
# -------------------------------------------------------------------
# Copyright 2001-2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# P R O J E C T P R O P E R T I E S
# -------------------------------------------------------------------
maven.abbot.sign.keystore = file:${basedir}/conf/keys
maven.abbot.sign.storepass = abbot-plugin
maven.abbot.sign.alias = abbot-plugin

View File

@@ -1,9 +0,0 @@
<?xml version="1.0"?>
<project>
<extend>${basedir}/../project.xml</extend>
<id>maven-abbot-plugin-test-sample-local</id>
<name>Maven Abbot plugin Local Sample Test</name>
<description>Run Abbot tests on local sample</description>
<shortDescription>Run Abbot tests on local sample</shortDescription>
</project>

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<AWTTestScript>
<component class="javax.swing.JButton" id="Click Here" index="0" parent="JPanel Instance" text="Click Here" window="TestFrame Instance" />
<component class="javax.swing.JLayeredPane" id="JLayeredPane Instance" index="1" parent="JRootPane Instance" window="TestFrame Instance" />
<component class="javax.swing.JPanel" id="JPanel Instance" index="0" parent="JLayeredPane Instance" window="TestFrame Instance" />
<component class="javax.swing.JRootPane" id="JRootPane Instance" index="0" parent="TestFrame Instance" />
<component class="javax.swing.JTextField" id="JTextField Instance" index="1" parent="JPanel Instance" window="TestFrame Instance" />
<component class="org.apache.maven.abbot.sample.Main" id="TestFrame Instance" root="true" title="" />
<launch args="[]" class="org.apache.maven.abbot.sample.Main" classpath="." desc="Sample test" method="main" />
<assert component="JTextField Instance" method="getText" value="initial" />
<sequence>
<action args="Click Here" class="javax.swing.AbstractButton" method="actionClick" />
<action args="TestFrame Instance" class="java.awt.Window" method="actionClose" />
</sequence>
<assert component="JTextField Instance" method="getText" value="modified" />
<terminate/>
</AWTTestScript>

View File

@@ -1,56 +0,0 @@
package org.apache.maven.abbot.sample;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import javax.swing.JFrame;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JTextField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Main extends JFrame
{
public JButton button;
public JTextField textField;
public Main()
{
getContentPane().setLayout(new FlowLayout());
textField = new JTextField("initial");
button = new JButton("Click Here");
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
textField.setText("modified");
}
}
);
getContentPane().add(button);
getContentPane().add(textField);
this.pack();
}
public static void main(String[] argv)
{
Main frame = new Main();
frame.show();
}
}

View File

@@ -1,25 +0,0 @@
# -------------------------------------------------------------------
# Copyright 2001-2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
# Copy this file to a build.properties file and edit to match your local
# environment.
# Locations where your Java web start caches are located.
# For example on Windows XP:
maven.abbot.javaws.systemhome = C:/WINDOWS/Sun/Java/Deployment
maven.abbot.javaws.userhome = C:/Documents and Settings/[replace with user name]/Application Data/Sun/Java/Deployment

View File

@@ -1,20 +0,0 @@
<?xml version="1.0"?>
<project xmlns:j="jelly:core" xmlns:ant="jelly:ant">
<goal name="dist">
<!-- Start Jetty -->
<j:thread>
<attainGoal name="jetty:run-war"/>
</j:thread>
<ant:waitfor>
<ant:http url="http://localhost:8081/maven-abbot-plugin-test-sample-webstart/sample.jnlp"/>
</ant:waitfor>
<!-- Start Abbot webstart tests -->
<attainGoal name="abbot:test-webstart"/>
</goal>
</project>

View File

@@ -1,24 +0,0 @@
# -------------------------------------------------------------------
# Copyright 2001-2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
maven.jetty.port = 8081
maven.abbot.sign = true
maven.abbot.sign.force = false
maven.abbot.remotejnlp = http://localhost:8081/maven-abbot-plugin-test-sample-webstart/sample.jnlp
maven.abbot.sign.keystore = file:${basedir}/conf/keys
maven.abbot.sign.storepass = abbot-plugin
maven.abbot.sign.alias = abbot-plugin

View File

@@ -1,25 +0,0 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/3.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/3.0.0
http://maven.apache.org/maven-v3_0_0.xsd">
<extend>${basedir}/../project.xml</extend>
<id>maven-abbot-plugin-test-sample-webstart</id>
<name>Maven Abbot plugin Webstart Sample Test</name>
<description>Run Abbot tests on webstart sample</description>
<shortDescription>Run Abbot tests on webstart sample</shortDescription>
<dependencies>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-abbot-plugin-test-sample-local</artifactId>
<version>1.0</version>
<properties>
<war.target.path>.</war.target.path>
</properties>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>1.0</version>
<type>plugin</type>
</dependency>
</dependencies>
</project>

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<AWTTestScript>
<component class="javax.swing.JButton" id="Click Here" index="0" parent="JPanel Instance" text="Click Here" window="TestFrame Instance" />
<component class="javax.swing.JLayeredPane" id="JLayeredPane Instance" index="1" parent="JRootPane Instance" window="TestFrame Instance" />
<component class="javax.swing.JPanel" id="JPanel Instance" index="0" parent="JLayeredPane Instance" window="TestFrame Instance" />
<component class="javax.swing.JRootPane" id="JRootPane Instance" index="0" parent="TestFrame Instance" />
<component class="javax.swing.JTextField" id="JTextField Instance" index="1" parent="JPanel Instance" window="TestFrame Instance" />
<component class="org.apache.maven.abbot.sample.Main" id="TestFrame Instance" root="true" title="" />
<launch args="[]" class="org.apache.maven.abbot.sample.Main" classpath="." desc="Sample test" method="main" />
<assert component="JTextField Instance" method="getText" value="initial" />
<sequence>
<action args="Click Here" class="javax.swing.AbstractButton" method="actionClick" />
<action args="TestFrame Instance" class="java.awt.Window" method="actionClose" />
</sequence>
<assert component="JTextField Instance" method="getText" value="modified" />
<terminate/>
</AWTTestScript>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
</web-app>

View File

@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<jnlp href="sample.jnlp" spec="1.0+" codebase="http://localhost:8081/maven-abbot-plugin-test-sample-webstart/">
<information>
<title>Sample webstart application</title>
<vendor>Apache Software Foundation</vendor>
<homepage href="index.html"/>
<description>Sample webstart application</description>
<description kind="short">Sample webstart application</description>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.3+"/>
<jar href="maven-abbot-plugin-test-sample-local-1.0.jar"/>
</resources>
<application-desc main-class="org.apache.maven.abbot.sample.Main"/>
</jnlp>

View File

@@ -1,85 +0,0 @@
package org.apache.maven.abbot;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import junit.extensions.abbot.ScriptFixture;
import junit.framework.Test;
import junit.framework.TestCase;
/**
* Unit tests for {@link AbbotTestAll}.
*/
public class AbbotTestAllTest extends TestCase
{
public void testGetScriptFileNamesNoPropertyDefined()
{
assertNull("The maven.abbot.src.files property must not be set for "
+ "this test", System.getProperty("maven.abbot.src.files"));
String[] result = AbbotTestAll.getScriptFileNames();
assertNull(result);
}
public void testGetScriptFileNamesEmptyFileList()
{
System.setProperty("maven.abbot.src.files", "");
String[] result = AbbotTestAll.getScriptFileNames();
assertNull(result);
}
public void testGetScriptFileNamesSingleFile()
{
System.setProperty("maven.abbot.src.files", "c:/some/file");
String[] result = AbbotTestAll.getScriptFileNames();
assertEquals(1, result.length);
assertEquals("c:/some/file", result[0]);
}
public void testGetScriptFileNamesTwoFiles()
{
System.setProperty("maven.abbot.src.files",
"c:/some/file,c:/other/file");
String[] result = AbbotTestAll.getScriptFileNames();
assertEquals(2, result.length);
assertEquals("c:/some/file", result[0]);
assertEquals("c:/other/file", result[1]);
}
/**
* Verify we can construct a valid
* {@link junit.extensions.abbot.ScriptTestSuite} object when
* executing a single script.
*/
public void testConstructionOfScriptTestSuiteWithUniqueScript()
{
System.setProperty("maven.abbot.src.files", "c:/some/file.xml");
Test suite = AbbotTestAll.suite();
assertNotNull(suite);
assertEquals(AbbotTestAll.MavenScriptTestSuite.class.getName(),
suite.getClass().getName());
AbbotTestAll.MavenScriptTestSuite mavenSuite =
(AbbotTestAll.MavenScriptTestSuite) suite;
assertEquals(1, mavenSuite.testCount());
Test test = (Test) mavenSuite.tests().nextElement();
assertEquals(ScriptFixture.class.getName(), test.getClass().getName());
}
}

View File

@@ -1,33 +0,0 @@
package org.apache.maven.abbot;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import junit.framework.TestCase;
/**
* Unit tests for {@link AbbotWebstartTestRunner}.
*/
public class AbbotTestRunnerMainTest extends TestCase
{
public void testExecuteOk() throws Exception
{
AbbotWebstartTestRunner runner = new AbbotWebstartTestRunner();
runner.execute(SampleTest.class.getName(),
System.getProperty("maven.abbot.reports.dir", ""));
}
}

View File

@@ -1,32 +0,0 @@
package org.apache.maven.abbot;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import junit.framework.TestCase;
/**
* Dummy test to verify that {@link AbbotWebstartTestRunner#execute}
* can execute it properly.
*/
public class SampleTest extends TestCase
{
public void testXXX()
{
assertTrue("Should have been true...", true);
}
}

View File

@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<document>
<properties>
<title>Changes</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<release version="1.2-SNAPSHOT" date="in SVN">
<action dev="aheritier" type="update" issue="MAVEN-1712">Update dependencies to match ones in maven 1.1 core and to unify them between plugins. The following dependencies are updated :
<ul>
<li>ant v1.5.3-1 -> v1.6.5</li>
<li>ant-junit (ant-optional) v1.5.3-1 -> v1.6.5</li>
<li>commons-jelly-tags-xml v1.0 -> v1.1</li>
<li>jdom v b10 -> v1.0</li>
<li>xercesImpl v 2.4.0 -> v2.6.2</li>
<li>xmlParserAPIs v 2.2.1 -> v2.6.2</li>
</ul>
</action>
<action dev="vmassol" type="update">
Removed the need to set up a <code>JAVAWS_HOME</code> property. This is
now automatically inferred from <code>${java.home}</code> and defaults
to <code>${java.home}/javaws</code>. You can override this value by
setting the <code>maven.abbot.webstart.home</code> property.
</action>
</release>
<release version="1.1" date="2004-09-27">
<action dev="vmassol" type="update">Upgraded to Abbot 0.13.0 and JDOM 1.0 beta 10.</action>
<action dev="vmassol" type="add">Added new
<code>maven.abbot.extrajars</code>property that can be used to specify extra jars to be added to the executing classpath. For example, this is useful to add custom Abbot tester classes.
</action>
</release>
<release version="1.0" date="2004-07-08">
<action dev="vmassol" type="add">Initial creation by Christian Blavier and Vincent Massol. See the feature list on the Abbot plugin web site for a full list of what the plugin does.</action>
</release>
</body>
</document>

View File

@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<document>
<properties>
<title>Maven Abbot plugin goals</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<goals>
<goal>
<name>abbot</name>
<description>
Default goal. Does the same as <code>abbot:test</code>.
</description>
</goal>
<goal>
<name>abbot:test</name>
<description>
Runs Abbot tests (Costello XML scripts).
</description>
</goal>
<goal>
<name>abbot:test-webstart</name>
<description>
Runs Abbot tests (Costello XML scripts) against an already
installed WebStart application.
</description>
</goal>
<goal>
<name>abbot:editor</name>
<description>
Start the Abbot Costello editor.
</description>
</goal>
<goal>
<name>abbot:editor-webstart</name>
<description>
Start the Abbot Costello editor, using the jars from an already
installed WebStart application.
</description>
</goal>
</goals>
</body>
</document>

View File

@@ -1,38 +0,0 @@
<?xml version="1.0"?>
<document>
<properties>
<title>Maven Abbot plugin</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<section name="What is the Abbot plugin?">
<p>
Provides the following features:
</p>
<ul>
<li>
Ability to start the Abbot Costello editor using either jars
defined in the POM or the jars from an already installed
WebStart application.
</li>
<li>
Ability to execute Abbot XML scripts through the Ant &lt;junit&gt;
task
</li>
<li>
Ability to execute Abbot XML scripts on an already installed
WebStart application (end-to-end functional testing)
</li>
</ul>
</section>
<section name="Using the plugin">
<p>
See the <a href="using.html">usage tutorial</a>.
</p>
</section>
</body>
</document>

View File

@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project name="Maven Abbot plugin">
<title>Maven Abbot plugin</title>
<body>
<breadcrumbs>
<item name="Apache" href="http://www.apache.org"/>
<item name="Maven" href="http://maven.apache.org/"/>
<item name="Maven 1.x" href="http://maven.apache.org/maven-1.x/"/>
</breadcrumbs>
<links>
<item name="Maven 1.x plugins" href="http://maven.apache.org/maven-1.x/reference/plugins/index.html"/>
<item name="Maven 1.x plugins Sandbox" href="http://maven.apache.org/maven-1.x/plugins-sandbox/index.html"/>
<item name="Continuum" href="http://maven.apache.org/continuum/index.html"/>
<item name="Maven 2.0" href="http://maven.apache.org/"/>
<item name="Abbot" href="http://abbot.sourceforge.net/"/>
</links>
<menu name="Overview">
<item name="Using" href="/using.html"/>
<item name="Goals" href="/goals.html"/>
<item name="Properties" href="/properties.html"/>
</menu>
</body>
</project>

View File

@@ -1,99 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<document>
<properties>
<title>Maven Abbot plugin properties</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<section name="Abbot plugin properties">
<source><![CDATA[
# -------------------------------------------------------------------
# Properties required for all the abbot plugin goals
# -------------------------------------------------------------------
# Location of abbot source scripts
maven.abbot.src.dir = ${maven.src.dir}/abbot
# (optional) Explicit comma-separated list of Abbot source scripts
# to execute. If not defined, the plugin will execute all .xml files
# located in maven.abbot.src.dir
# maven.abbot.src.files =
# Decide whether or not to recurse in maven.abbot.src.dir to find
# Abbot .xml source scripts.
maven.abbot.recurse = true
# Location where the abbot plugin puts build files related to abbot
maven.abbot.dest.dir = ${maven.build.dir}/abbot
# Location where the abbot plugin signs the jars to be added to the
# generated JNLP file.
maven.abbot.dest.jar.dir = ${maven.abbot.dest.dir}/jars
# Location where abbot junit test results will be located
maven.abbot.reports.dir = ${maven.build.dir}/abbot-reports
maven.abbot.printSummary = ${maven.junit.printSummary}
maven.abbot.dir = ${maven.junit.dir}
maven.abbot.sysproperties = ${maven.junit.sysproperties}
maven.abbot.jvmargs = ${maven.junit.jvmargs}
maven.abbot.format = ${maven.junit.format}
maven.abbot.usefile = ${maven.junit.usefile}
# (optional) Name of the test suite beeing executed. This name will be used
# to name the generated JUnit test report. If not specified the report name
# will be TEST-org.apache.maven.abbot.AbbotTestAll. This is useful when
# you're calling the Abbot plugin several times in a row as otherwise the
# reports will overwrite each other.
#maven.abbot.suite.name = MyTestSuite
# Decide whether to turn on webstart debugging.
maven.abbot.debug = false
# -------------------------------------------------------------------
# Properties required only for the abbot:test goal
# -------------------------------------------------------------------
# Name of the JUnit test to execute that will trigger the execution
# of the Abbot scripts. This name should not be changed unless you
# want to provide your own Abbot script wrapper.
maven.abbot.include = org.apache.maven.abbot.AbbotTestAll
# -------------------------------------------------------------------
# Properties required only for the abbot:test-webstart goal
# -------------------------------------------------------------------
# The following properties are mandatories. They depend on your
# execution environment and must be set in your build.properties file
# or equivalent:
#
# - maven.abbot.remotejnlp: This property points to the JNLP file of
# the application you're testing.
# - maven.abbot.javaws.systemhome: Java webstart system cache location
# - maven.abbot.javaws.userhome: Java webstart user cache location
# Location of webstart executable. Override if your install does not match
# this default location
maven.abbot.webstart.home = ${java.home}/javaws
# TODO: Remove these 4 properties as I don't see any use case associated with them
maven.abbot.webstart.jnlp.original = original.jnlp
maven.abbot.webstart.jnlp.modified = modified.jnlp
maven.abbot.webstart.main.jar = abbot-main.jar
maven.abbot.webstart.main.class = org.apache.maven.abbot.AbbotWebstartTestRunner
# Note: For now we only support signing jars. The reason is that we need
# to add the Abbot jars to the JNLP file and as we're taking these jars
# from the local file system we need to have the permissions and thus we
# need signed jars to get these permissions.
maven.abbot.sign = true
# Extra list of jars (separated by commas) to be added to the generated JNLP
# and to the executing CP for the editor goal. This is useful for example when
# creating custom Abbot testers that need to be included in the executing CP.
#maven.abbot.extrajars =
]]></source>
</section>
</body>
</document>

View File

@@ -1,71 +0,0 @@
<?xml version="1.0"?>
<document>
<properties>
<title>Using the Abbot plugin</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<section name="Using the Abbot plugin">
<p>
There are 2 possible ways to use the plugin:
</p>
<ul>
<li>
Using the <code>abbot:test</code> goal. You would call this goal
from inside your application project. This project needs to
define all your application required dependencies in its
<code>project.xml</code>.
</li>
<li>
Using the <code>abbot:test-webstart</code> goal. You would call
this goal if you wish to test a WebStart application that is
already installed on some server. In this mode your project does
not require to define any dependency.
</li>
</ul>
</section>
<section name="Using the abbot:test goal">
<subsection name="Pre-requisites">
<p>
There are no pre-requisites.
</p>
</subsection>
</section>
<section name="Using the abbot:test-webapp goal">
<subsection name="Pre-requisites">
<p>
The following environmental dependencies need to be present before
executing the Abbot plugin:
</p>
<ul>
<li>
Some mandatory environment-dependent properties need to be
defined. See the <a href="properties.html">Properties</a>
page for the details.
</li>
</ul>
</subsection>
<subsection name="Limitations">
<p>
The following limitations are known for the
<code>abbot:test-webstart</code> goal:
</p>
<ul>
<li>
You need to provide a key to sign your webstart jars. This is
required as we're packaging local filesystem jars
into the application's JNLP and we need to have the permissions
to do so (granted if the jar are signed).
</li>
</ul>
</subsection>
</section>
</body>
</document>

View File

@@ -1,135 +0,0 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:define="jelly:define"
xmlns:castor="castor"
xmlns:maven="jelly:maven">
<!-- ================================================================== -->
<!-- C A S T O R -->
<!-- ================================================================== -->
<goal name="castor:prepare-filesystem"
description="Make any necessary directories for castor processing">
<ant:mkdir dir="${maven.castor.dest}"/>
<ant:mkdir dir="${maven.castor.tstamp}"/>
<ant:path id="maven.castor.compile.src.set"
location="${maven.castor.dest}"/>
<maven:addPath id="maven.compile.src.set"
refid="maven.castor.compile.src.set"/>
<!-- determine if SourceGenerator needs to be run in a separate JVM, -->
<!-- to pick up the castorbuilder.properties file -->
<j:set var="dir" value="${maven.castor.properties.dir}"/>
<j:choose>
<!-- NOTE: need to set temp 'dir' var as -->
<!-- !empty{maven.castor.properties.dir} doesn't -->
<!-- work as expected. -->
<j:when test="${!empty(dir)}">
<ant:property name="maven.castor.fork" value="true"/>
<ant:path id="maven.castor.classpath">
<ant:path refid="maven.dependency.classpath"/>
<ant:pathelement location="${maven.castor.properties.dir}"/>
</ant:path>
</j:when>
<j:otherwise>
<ant:property name="maven.castor.fork" value="false"/>
<ant:path id="maven.castor.classpath">
<ant:path refid="maven.dependency.classpath"/>
</ant:path>
</j:otherwise>
</j:choose>
</goal>
<define:taglib uri="castor">
<define:tag name="generate">
<j:set var="fileVar" value="${schema}.filename"/>
<j:set var="uptodateVar" value="${schema}.uptodate"/>
<ant:basename property="${fileVar}" file="${schema}"/>
<!-- need to jump through some hoops to get values, in order to -->
<!-- support maven 1.0-beta-10 -->
<j:set var="filename"
value="${pom.context.getVariable(fileVar)}"/>
<j:set var="context"
value="${pom.getPluginContext('maven-castor-plugin')}"/>
<j:set var="log" value="${context.getVariable('maven.castor.tstamp')}"/>
<j:set var="gen" value="${context.getVariable('maven.castor.dest')}"/>
<ant:uptodate property="${uptodateVar}" targetfile="${log}/${filename}">
<ant:srcfiles dir="${basedir}" includes="${schema}"/>
</ant:uptodate>
<j:set var="uptodate" value="${pom.context.getVariable(uptodateVar)}"/>
<j:if test="${uptodate == null}">
<ant:echo message="Generating sources for ${schema}"/>
<ant:java className="org.exolab.castor.builder.SourceGenerator"
fork="${maven.castor.fork}"
failonerror="true">
<ant:arg value="-i"/>
<ant:arg value="${schema}"/>
<ant:arg value="-f"/>
<j:if test="${!empty(package)}">
<ant:arg value="-package"/>
<ant:arg value="${package}"/>
</j:if>
<j:if test="${!empty(types)}">
<ant:arg value="-types"/>
<ant:arg value="${types}"/>
</j:if>
<j:if test="${!empty(marshal) and !marshal.trim().equals('true')}">
<ant:arg value="-nomarshall"/>
</j:if>
<ant:arg value="-dest"/>
<ant:arg value="${gen}"/>
<ant:classpath refid="maven.castor.classpath"/>
</ant:java>
<ant:touch file="${log}/${filename}"/>
</j:if>
</define:tag>
<!-- needs to be deprecated -->
<define:tag name="srcgen">
<ant:echo message="DEPRECATED: castor:srcgen. Use castor:generate"/>
<ant:java
className="org.exolab.castor.builder.SourceGenerator"
failonerror="true">
<ant:arg value="-i${schema}"/>
<ant:arg value="-f"/>
<ant:arg value="-package${package}"/>
<ant:arg value="-types${types}"/>
<ant:arg value="-nomarshall"/>
<ant:arg value="-dest${generationDirectory}"/>
</ant:java>
</define:tag>
</define:taglib>
</project>

View File

@@ -1,26 +0,0 @@
# -------------------------------------------------------------------
# Copyright 2001-2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# Default Maven properties for the Castor plugin.
# -------------------------------------------------------------------
# These are the properties that we believe are immutable so we
# keep them apart from the project specific properties.
# -------------------------------------------------------------------
maven.castor.properties.dir=
maven.castor.dest=${maven.build.dir}/castor/src
maven.castor.tstamp=${maven.build.dir}/castor/tstamp

View File

@@ -1,19 +0,0 @@
# -------------------------------------------------------------------
# Copyright 2001-2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# P R O J E C T P R O P E R T I E S
# -------------------------------------------------------------------

View File

@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project xmlns="http://maven.apache.org/POM/3.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/3.0.0 http://maven.apache.org/maven-v3_0_0.xsd">
<extend>../plugins-parent/project.xml</extend>
<pomVersion>3</pomVersion>
<id>maven-castor-plugin</id>
<name>Maven Castor Plugin</name>
<currentVersion>1.2</currentVersion>
<description>Various goals for making development with Plexus easy.</description>
<shortDescription>Plexus Tools</shortDescription>
<versions>
<version>
<id>1.1</id>
<name>1.1</name>
<tag>MAVEN_CASTOR_1_1</tag>
</version>
<version>
<id>1.2</id>
<name>1.2</name>
<tag>MAVEN_CASTOR_1_2</tag>
</version>
</versions>
<developers>
<developer>
<name>Jason van Zyl</name>
<id>jvanzyl</id>
<email>jason@zenplex.com</email>
<organization>Zenplex</organization>
<roles>
<role>Architect</role>
<role>Release Manager</role>
</roles>
</developer>
</developers>
<contributors>
<contributor>
<name>Tim Anderson</name>
<email>tma@netspace.net.au</email>
</contributor>
</contributors>
<dependencies>
<dependency>
<groupId>castor</groupId>
<artifactId>castor</artifactId>
<version>0.9.5</version>
</dependency>
</dependencies>
</project>

View File

@@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>Changes</title>
<author email="jason@zenplex.com">Jason van Zyl</author>
</properties>
<body>
<release version="1.2" date="2004-05-15"></release>
<release version="1.1" date="2004-02-04">
<action dev="tima" type="add">Added
<em>maven.castor.properties.dir</em>property.
</action>
<action dev="tima" type="update">Updated to castor 0.9.5</action>
</release>
<release version="1.0" date="2002-08-04">
<action dev="jvanzyl" type="add">Original release for Maven 1.0-beta8</action>
</release>
</body>
</document>

View File

@@ -1,60 +0,0 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>Maven Castor Plug-in Examples</title>
<author email="tma@netspace.net.au">Tim Anderson</author>
</properties>
<body>
<section name="Examples">
<p>
The following generates java sources for the foo.xsd' schema,
in the 'com.foo.bar' package. The sources will use Java 2 collection
types.
</p>
<source><![CDATA[
<preGoal name="java:compile">
<attainGoal name="castor:prepare-filesystem"/>
<castor:generate schema="src/schemas/foo.xsd"
package="com.foo.bar"
types="j2"/>
</preGoal>
]]></source>
<p>
The following generates java sources for the 'bar.xsd' schema.
The sources will not included marshalling support (marshal,
unmarshal, validate).
</p>
<source><![CDATA[
<preGoal name="java:compile">
<attainGoal name="castor:prepare-filesystem"/>
<castor:generate schema="src/schemas/types.xsd"
marshal="false"/>
</preGoal>
]]></source>
</section>
</body>
</document>

View File

@@ -1,43 +0,0 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>Maven Castor Plug-in Goals</title>
<author email="jason@zenplex.com">Jason van Zyl</author>
<author email="tma@netspace.net.au">Tim Anderson</author>
</properties>
<body>
<section name="Goals">
<table>
<tr><th>Goal</th><th>Description</th></tr>
<tr>
<td>castor:prepare-filesystem</td>
<td>
Creates the directories specified by the
<a href="properties.html">${maven.castor.dest}</a> and
<a href="properties.html">${maven.castor.tstamp}</a> properties.
</td>
</tr>
</table>
</section>
</body>
</document>

View File

@@ -1,65 +0,0 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>Maven Castor Plug-in</title>
<author email="jason@zenplex.com">Jason van Zyl</author>
<author email="tma@netspace.net.au">Tim Anderson</author>
</properties>
<body>
<section name="Maven Castor Plug-in">
<subsection name="Overview of the Castor Plug-in Reference Documentation"> <p>
This plugin generates java sources from schemas using Castor.
</p>
<table>
<tr><th>Document</th><th>Description</th></tr>
<tr><td><a href="goals.html">Goals</a></td>
<td>
This document provides detailed information on the various
goals that are available as part of the Maven Castor Plug-in.
</td>
</tr>
<tr><td><a href="properties.html">Properties</a></td>
<td>
The behavior of the Maven Castor Plug-in can be altered via
several properties. This document describes each property
available, and the default used.
</td>
</tr>
<tr><td><a href="tags.html">Tags</a></td>
<td>
The Castor plugin defines Jelly tags to generate java
sources. This document describes the tags and their
arguments.
</td>
</tr>
<tr><td><a href="examples.html">Examples</a></td>
<td>
This document provides examples on how to use the Maven Castor
plugin.
</td>
</tr>
</table>
</subsection>
</section>
</body>
</document>

View File

@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project name="Maven Castor Plugin">
<title>Maven Castor Plugin</title>
<body>
<breadcrumbs>
<item name="Apache" href="http://www.apache.org"/>
<item name="Maven" href="http://maven.apache.org/"/>
<item name="Maven 1.x" href="http://maven.apache.org/maven-1.x/"/>
</breadcrumbs>
<links>
<item name="Maven 1.x plugins" href="http://maven.apache.org/maven-1.x/reference/plugins/index.html"/>
<item name="Maven 1.x plugins Sandbox" href="http://maven.apache.org/maven-1.x/plugins-sandbox/index.html"/>
<item name="Continuum" href="http://maven.apache.org/continuum/index.html"/>
<item name="Maven 2.0" href="http://maven.apache.org/"/>
<item name="Castor" href="http://castor.exolab.org/"/>
</links>
<menu name="Overview">
<item name="Goals" href="/goals.html"/>
<item name="Properties" href="/properties.html"/>
<item name="Tags" href="/tags.html"/>
<item name="Examples" href="/examples.html"/>
</menu>
</body>
</project>

View File

@@ -1,83 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>Maven Castor Plugin Properties</title>
<author email="jason@zenplex.com">Jason van Zyl</author>
<author email="tma@netspace.net.au">Tim Anderson</author>
</properties>
<body>
<section name="Maven Castor Plugin Settings">
<table>
<tr>
<th>Property name</th>
<th>Description</th>
<th>Optional?</th>
</tr>
<tr>
<td>maven.castor.properties.dir</td>
<td>
Specifies the directory to locate the
<em>castorbuilder.properties</em> file.
</td>
<td>Yes</td>
</tr>
<tr>
<td>maven.castor.dest</td>
<td>
Specifies the directory to place generated sources.<br/>
Defaults value is ${maven.build.dir}/castor/src
</td>
<td>Yes</td>
</tr>
<tr>
<td>maven.castor.tstamp</td>
<td>
Specifies the directory to output timestamp files.
These are used to track source modifications against the
generated files, to avoid unecessary generation.<br/>
Default value is ${maven.build.dir}/castor/tstamp
</td>
<td>Yes</td>
</tr>
</table>
</section>
<section name="Other properties used">
<table>
<tr>
<th>Property name</th>
<th>Description</th>
<th>Optional?</th>
</tr>
<tr>
<td>maven.compile.src.set</td>
<td>
The source directories maven uses to compile java code.
The Castor plugin adds the directory it generates code to
this path, so that generated code is compiled seamlessly
</td>
<td>Yes</td>
</tr>
</table>
</section>
</body>
</document>

View File

@@ -1,104 +0,0 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>Maven Castor Plug-in Tags</title>
<author email="tma@netspace.net.au">Tim Anderson</author>
</properties>
<body>
<section name="Overview">
<p>
This document describes the
<a href="http://jakarta.apache.org/commons/jelly/tags.html">tags</a>
that are available when using the Castor Plug-in with Maven.
</p>
<p>
Please refer to the
<a href="../../start/integrate.html">Integration</a> document for
more information on how to integrate these tags into
your project.
</p>
</section>
<section name="Tags">
<table>
<tr><th>Goal</th><th>Description</th></tr>
<tr>
<td><a href="#castor:generate">castor:generate</a></td>
<td>Generate java sources from an XML Schema.</td>
</tr>
<tr>
<td>castor:srcgen</td>
<td><strong>DEPRECATED</strong>. Use castor:generate instead</td>
</tr>
</table>
<subsection name="castor:generate">
<p>
The <code>castor:generate</code> target generates java sources
from an XML Schema (<code>XSD</code> file). <br/>
Sources are generated in the
<a href="properties.html">${maven.castor.dest}</a> directory.<br/>
Sources are only generated if the input schema is newer than any
existing generated source.
</p>
<table>
<tr>
<th>Attribute Name</th><th>Description</th><th>Optional?</th>
</tr>
<tr>
<td>schema</td>
<td>The path to the XML schema</td>
<td>No</td>
</tr>
<tr>
<td>package</td>
<td>The package for the generated source</td>
<td>Yes</td>
</tr>
<tr>
<td>types</td>
<td>Sets which type factory to use. This is useful if you want
JDK 1.2 collections instead of JDK 1.1, or if you want to pass
in your own FieldInfoFactory.<br/>
If not specified, java.util.Vector will be used for
collections.<br/>
See
<a href="http://castor.exolab.org/sourcegen.html#Collection-Types">Collection Types</a>
for valid values.
</td>
<td>Yes</td>
</tr>
<tr>
<td>marshal</td>
<td>
If 'false', disables generation of the marshalling framework
methods (marshal, unmarshal, validate).<br/>
Defaults to 'true'.
</td>
<td>Yes</td>
</tr>
</table>
</subsection>
</section>
</body>
</document>

View File

@@ -1,88 +0,0 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:h="jelly:org.apache.maven.hibernate.jelly.HibernateTagLibrary">
<goal name="hibernate:init">
<ant:mkdir dir="${maven.hibernate.output.dir}"/>
</goal>
<goal name="hibernate:aggregate-mappings" prereqs="hibernate:init" description="Aggregate multiple .hbm.xml files into one file">
<ant:echo>Aggregating multiple hibernate mapping into one single file</ant:echo>
<h:aggregate-mappings
aggregateOutputFile="${maven.hibernate.aggregate.output.file}"
basedir="${maven.hibernate.input.dir}"
includes="${maven.hibernate.input.includes}"
excludes="${maven.hibernate.input.excludes}"/>
</goal>
<goal name="hibernate:schema-export" prereqs="hibernate:init" description="Export Hibernate schema">
<ant:echo>Exporting Hibernate Schema file</ant:echo>
<h:schema-export
properties="${maven.hibernate.properties}"
config="${maven.hibernate.config}"
quiet="${maven.hibernate.quiet}"
text="${maven.hibernate.text}"
drop="${maven.hibernate.drop}"
delimiter="${maven.hibernate.delimiter}"
outputFile="${maven.hibernate.output.file}"
basedir="${maven.hibernate.input.dir}"
includes="${maven.hibernate.input.includes}"
excludes="${maven.hibernate.input.excludes}"/>
</goal>
<goal name="hibernate:schema-update" prereqs="hibernate:init" description="Update Hibernate schema">
<ant:echo>Updating database schema</ant:echo>
<h:schema-update
properties="${maven.hibernate.properties}"
config="${maven.hibernate.config}"
quiet="${maven.hibernate.quiet}"
text="${maven.hibernate.text}"
basedir="${maven.hibernate.input.dir}"
includes="${maven.hibernate.input.includes}"
excludes="${maven.hibernate.input.excludes}"/>
</goal>
<goal name="hibernate:code-generation" prereqs="hibernate:init" description="Generate POJOs from hbm files">
<ant:echo>Generating POJOs from hbm files</ant:echo>
<h:code-generation
basedir="${maven.hibernate.codeGeneration.input.dir}"
includes="${maven.hibernate.codeGeneration.input.includes}"
excludes="${maven.hibernate.codeGeneration.input.excludes}"
outputdir="${maven.hibernate.codeGeneration.output.dir}"/>
</goal>
</project>

View File

@@ -1,31 +0,0 @@
# -------------------------------------------------------------------
# Copyright 2001-2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
#maven.hibernate.properties=
maven.hibernate.quiet=yes
maven.hibernate.text=no
maven.hibernate.drop=no
maven.hibernate.delimiter=
maven.hibernate.output.dir=${maven.build.dir}/schema
maven.hibernate.output.file=${maven.hibernate.output.dir}/${maven.final.name}-schema.sql
maven.hibernate.input.dir=${maven.build.dest}
maven.hibernate.input.includes=**/*.hbm.xml
maven.hibernate.input.excludes=
maven.hibernate.aggregate.output.file=${maven.hibernate.output.dir}/aggregated-mappings.hbm.xml
maven.hibernate.codeGeneration.input.dir=${maven.src.dir}/hibernate
maven.hibernate.codeGeneration.output.dir=${maven.src.dir}/hibernate
maven.hibernate.codeGeneration.input.includes=${maven.hibernate.input.includes}
maven.hibernate.codeGeneration.input.excludes=

View File

@@ -1,19 +0,0 @@
# -------------------------------------------------------------------
# Copyright 2001-2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# P R O J E C T P R O P E R T I E S
# -------------------------------------------------------------------

View File

@@ -1,215 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project xmlns="http://maven.apache.org/POM/3.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/3.0.0 http://maven.apache.org/maven-v3_0_0.xsd">
<extend>../plugins-parent/project.xml</extend>
<pomVersion>3</pomVersion>
<id>maven-hibernate-plugin</id>
<name>Maven Hibernate Plugin</name>
<currentVersion>1.4-SNAPSHOT</currentVersion>
<description/>
<shortDescription>Work with Hibernate classes</shortDescription>
<versions>
<version>
<id>1.0</id>
<name>1.0</name>
<tag>MAVEN_HIBERNATE_1_0</tag>
</version>
<version>
<id>1.1</id>
<name>1.1</name>
<tag>MAVEN_HIBERNATE_1_1</tag>
</version>
<version>
<id>1.2</id>
<name>1.2</name>
<tag>MAVEN_HIBERNATE_1_2</tag>
</version>
<version>
<id>1.3</id>
<name>1.3</name>
<tag>MAVEN_HIBERNATE_1_3</tag>
</version>
</versions>
<developers>
<developer>
<name>Michal Maczka</name>
<id>michal</id>
<email>michal.maczka@dimatics.com</email>
<organization>Dimatics</organization>
<roles>
<role>Java Developer</role>
</roles>
<timezone>+1</timezone>
</developer>
<developer>
<name>Eric Pugh</name>
<id>epugh</id>
<email>epugh@opensourceconnections.com</email>
<organization>OpenSource Connections</organization>
<roles>
<role>Java Developer</role>
</roles>
</developer>
<developer>
<name>Felipe Leme</name>
<id>felipeal</id>
<email>maven@felipeal.net</email>
<organization>Falcon Informatica</organization>
<roles>
<role>Java Developer</role>
</roles>
<timezone>-3</timezone>
</developer>
</developers>
<contributors>
<contributor>
<name>Alex Shneyderman</name>
<email>as851@columbia.edu</email>
</contributor>
</contributors>
<dependencies>
<dependency>
<groupId>hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>2.1.3</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>hibernate</groupId>
<artifactId>hibernate-tools</artifactId>
<version>2.1.3</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>1.6.5</version>
<type>jar</type>
<properties>
<comment>This library is already loaded by maven's core. Be careful to use the same version number as in the core.</comment>
</properties>
</dependency>
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly</artifactId>
<version>1.0</version>
<url>http://jakarta.apache.org/commons/jelly/</url>
<properties>
<comment>This library is already loaded by maven's core. Be careful to use the same version number as in the core.</comment>
</properties>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.0</version>
<type>jar</type>
<properties>
<comment>This library is already loaded by maven's core. Be careful to use the same version number as in the core.</comment>
</properties>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6.1</version>
<type>jar</type>
<properties>
<comment>This library is already loaded by maven's core. Be careful to use the same version number as in the core.</comment>
</properties>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.0</version>
<type>jar</type>
<properties>
<comment>This library is already loaded by maven's core. Be careful to use the same version number as in the core.</comment>
</properties>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
<type>jar</type>
<properties>
<comment>This library is already loaded by maven's core. Be careful to use the same version number as in the core.</comment>
</properties>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.12</version>
<type>jar</type>
<properties>
<comment>This library is already loaded by maven's core. Be careful to use the same version number as in the core.</comment>
</properties>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xmlParserAPIs</artifactId>
<version>2.6.2</version>
<url>http://xerces.apache.org/xerces2-j/</url>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.6.2</version>
<url>http://xerces.apache.org/xerces2-j/</url>
</dependency>
<dependency>
<groupId>odmg</groupId>
<artifactId>odmg</artifactId>
<version>3.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.0.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.4</version>
<type>jar</type>
<properties>
<comment>This library is already loaded by maven's core. Be careful to use the same version number as in the core.</comment>
</properties>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0</version>
<type>jar</type>
</dependency>
</dependencies>
</project>

View File

@@ -1,106 +0,0 @@
package org.apache.maven.hibernate;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
* A class to resolve external entity definitions for j2ee artifacts.
* Based on the J2EEEntityResolver from the J2EE plugin
*
* @author eric pugh
* @version $Id$
*/
public class HibernateEntityResolver implements EntityResolver
{
/** map of ids to resource names */
private Map idToResource = new HashMap();
/** log for debug output */
private static final Log LOG = LogFactory.getLog(HibernateEntityResolver.class);
/** list of j2ee dtds that are being made available */
public static final String[] HIBERNATE_DTDS = new String[] {
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
};
public static final String[] HIBERNATE_RESOURCES = new String[] {
"/plugin-resources/hibernate-mapping-2.0.dtd"
};
/** Creates a new instance of EntityResolver */
public HibernateEntityResolver()
{
for (int i = 0; i < HIBERNATE_DTDS.length; i++) {
idToResource.put(HIBERNATE_DTDS[i], HIBERNATE_RESOURCES[i]);
}
}
/** resolve the entity given by the provided Ids
* @param publicId the public id of the entity
* @param systemId the 'system location' (typically a URL) of the entity
* @return an {@link InputSource input source} for retrieval of the entity
* @throws IOException when an I/O error occurs retrieving the entity
* @throws SAXException if there are any problems
*/
public InputSource resolveEntity(String publicId, String systemId) throws
SAXException, IOException
{
LOG.debug("resolving entity with publicId='" + publicId + ", systemId='" + systemId + "'");
if (publicId != null)
{
String resource = (String) idToResource.get(publicId);
LOG.debug("resource found in map ='" + resource + "'" );
if (resource != null)
{
InputStream in = getClass().getResourceAsStream(resource);
LOG.debug("input stream ='" + in + "'" );
if (in != null)
{
return new InputSource(in);
}
}
}
return null;
}
/** Getter for publicId to resource name map.
* @return Value of property idToResource.
*/
protected Map getIdToResource()
{
return idToResource;
}
/** Setter for publicId to resource name map.
* @param idToResource New value of property idToResource.
*/
protected void setIdToResource(Map idToResource)
{
this.idToResource = idToResource;
}
}

View File

@@ -1,61 +0,0 @@
package org.apache.maven.hibernate.beans;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import net.sf.hibernate.tool.hbm2java.CodeGenerator;
/**
* @author <a href="paulkearney@gmail.com">Paul Kearney</a>
* @version $Id$
*/
public class CodeGenerationBean extends CommonOperationsBean {
private static final String OUTPUT_SWITCH = "--output=";
private String outputdir = null;
public void execute() {
// Construct output directory argument
StringBuffer switchArg= new StringBuffer();
switchArg.append(OUTPUT_SWITCH).append(getOutputdir());
// Get list of files that are to be used to generate POJOs
final String[] files = getFileNames();
// Require new array to combine command args with hbm files array
String[] args = new String[files.length + 1];
// Add command arg to new array
args[0] = switchArg.toString();
// Copy list of hbm files to new array
System.arraycopy(files, 0, args, 1, files.length);
// Generate POJOs
CodeGenerator generator = new CodeGenerator();
generator.main(args);
}
public String getOutputdir() {
return this.outputdir;
}
public void setOutputdir(String outputdir) {
this.outputdir = outputdir;
}
}

View File

@@ -1,148 +0,0 @@
package org.apache.maven.hibernate.beans;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tools.ant.DirectoryScanner;
/**
*
* @author <a href="as851@columbia.edu">Alex Shneyderman</a>
* @since $Id$
*/
public class CommonOperationsBean {
private String includes = null;
private String excludes = null;
private String basedir = null;
private static final Log LOG = LogFactory.getLog(CommonOperationsBean.class);
public String getBasedir()
{
return basedir;
}
public void setBasedir(String basedir)
{
this.basedir = basedir;
}
public String getExcludes()
{
return excludes;
}
public void setExcludes(String excludes)
{
this.excludes = excludes;
}
public String getIncludes()
{
return includes;
}
public void setIncludes(String includes)
{
this.includes = includes;
}
protected String[] getBaseDirNames()
{
LOG.debug("Bases string: " + getBasedir());
StringTokenizer st = new StringTokenizer(getBasedir(), ",");
String r[] = new String[st.countTokens()];
for(int i = 0; st.hasMoreTokens(); i++)
r[i] = st.nextToken();
return r;
}
protected File[] getBaseDirs()
{
String bases[] = getBaseDirNames();
List l = new ArrayList();
for(int i = 0; i < bases.length; i++)
{
File t = new File(bases[i]);
if(t.isDirectory())
{
l.add(t);
LOG.info(" Adding base dir: " + t.getAbsolutePath());
}
}
return (File[])l.toArray(new File[0]);
}
protected String[] getFileNames()
{
List files = new LinkedList();
File dirs[] = getBaseDirs();
for(int i = 0; i < dirs.length; i++)
{
DirectoryScanner directoryScanner = new DirectoryScanner();
directoryScanner.setBasedir(dirs[i]);
LOG.debug("Base dir:" + dirs[i].getAbsolutePath());
LOG.debug("Excludes:" + getExcludes());
LOG.debug("Includes:" + getIncludes());
directoryScanner.setExcludes(StringUtils.split(getExcludes(), ","));
directoryScanner.setIncludes(StringUtils.split(getIncludes(), ","));
directoryScanner.scan();
String includesFiles[] = directoryScanner.getIncludedFiles();
for(int j = 0; j < includesFiles.length; j++)
{
File file = new File(includesFiles[j]);
if(!file.isFile())
file = new File(directoryScanner.getBasedir(), includesFiles[j]);
files.add(file.getAbsolutePath());
LOG.debug("work with file:" + file.getAbsolutePath());
}
}
return (String[])files.toArray(new String[0]);
}
protected File[] getFileDescriptors()
{
String names[] = getFileNames();
List files = new ArrayList();
for(int i = 0; i < names.length; i++)
{
File t = new File(names[i]);
if(t.isFile())
files.add(t);
}
return (File[])files.toArray(new File[0]);
}
}

View File

@@ -1,114 +0,0 @@
package org.apache.maven.hibernate.beans;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.io.File;
import java.io.FileWriter;
import java.util.Iterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.maven.hibernate.HibernateEntityResolver;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
/**
*
* @author <a href="as851@columbia.edu">Alex Shneyderman</a>
* @since $Id$
*/
public class MappingsAggregatorBean extends CommonOperationsBean
{
private String aggregateOutputFile = null;
private static final Log LOG = LogFactory.getLog(MappingsAggregatorBean.class);
public void execute()
throws Exception
{
String version = null;
File files[] = getFileDescriptors();
if(files == null || files.length <= 0)
{
LOG.info("nothing to process");
return;
}
LOG.info("Aggregating to " + getAggregateOutputFile());
File f = new File(getAggregateOutputFile());
OutputFormat format = OutputFormat.createPrettyPrint();
XMLWriter writer = new XMLWriter(new FileWriter(f), format);
writer.setEntityResolver(new HibernateEntityResolver());
//writer.setResolveEntityRefs(false);
Document finalDoc = DocumentHelper.createDocument();
Element rootHM = null;
for(int i = 0; i < files.length; i++)
{
SAXReader reader = new SAXReader(false);
reader.setEntityResolver(new HibernateEntityResolver());
//reader.setIncludeExternalDTDDeclarations(false);
//reader.setIncludeExternalDTDDeclarations(false);
Document current = reader.read(files[i]);
String currentVersion = getVersion(current);
if(version == null)
{
version = currentVersion;
finalDoc.setProcessingInstructions(current.processingInstructions());
finalDoc.setDocType(current.getDocType());
rootHM = finalDoc.addElement("hibernate-mapping");
} else
if(!version.equals(currentVersion))
{
LOG.warn("Mapping in " + files[i].getName() + " is not of the same mapping version as " + files[0].getName() + " mapping, so merge is impossible. Skipping");
continue;
}
for(Iterator iter = current.selectSingleNode("hibernate-mapping").selectNodes("class").iterator(); iter.hasNext(); rootHM.add((Element)((Element)iter.next()).clone()));
}
writer.write(finalDoc);
writer.close();
}
public String getAggregateOutputFile()
{
return aggregateOutputFile;
}
public void setAggregateOutputFile(String aggregateOutputFile)
{
this.aggregateOutputFile = aggregateOutputFile;
}
private String getVersion(Document current)
{
String docType = current.getDocType().getText();
if(docType == null || "".equals(docType.trim()))
return "";
if(docType.indexOf("hibernate-mapping-2.0.dtd") > 0)
return "2.0";
if(docType.indexOf("hibernate-mapping-1.1.dtd") > 0)
return "1.1";
else
return null;
}
}

View File

@@ -1,235 +0,0 @@
package org.apache.maven.hibernate.beans;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.cfg.Configuration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
*
* Base class for Beans which serve as Proxy To Hibernate API
* <br/>
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @author <a href="maven@felipeal.net">Felipe Leme</a>
* @version $Id$
*/
public abstract class SchemaBeanBase extends CommonOperationsBean
{
private String properties = null;
private String config = null;
private boolean quiet = false;
private boolean text = false;
protected static final Log LOG = LogFactory.getLog(MappingsAggregatorBean.class);
/**
* @return
*/
public boolean getQuiet()
{
return quiet;
}
/**
* @return
*/
public boolean getText()
{
return text;
}
/**
* @param b
*/
public void setQuiet(boolean b)
{
quiet = b;
}
/**
* @param b
*/
public void setText(boolean b)
{
text = b;
}
/**
* @return
*/
public String getConfig()
{
return config;
}
/**
* @return
*/
public String getProperties()
{
return properties;
}
/**
* @param string
*/
public void setConfig(String string)
{
config = string;
}
/**
* @param string
*/
public void setProperties(String string)
{
properties = string;
}
/**
*
* Hibernate requires that
* Java classes (beans) are accesible on the
* classpath. As they are not in plugin classpath
* we have to take care about.
* To assure that we have them visible for plugin
* classloader
* we will make temporay change to context classloader
* which will be restored when method terminates.
*
*/
public void execute() throws Exception
{
Thread currentThread = Thread.currentThread();
ClassLoader oldClassLoader = currentThread.getContextClassLoader();
try
{
File [] baseDirs = getBaseDirs ();
URL [] urls = new URL [baseDirs.length];
for (int i = 0; i < urls.length; i++) {
urls [i] = baseDirs [i].toURL ();
}
URLClassLoader newClassLoader =
new URLClassLoader(urls, getClass().getClassLoader());
currentThread.setContextClassLoader(newClassLoader);
Configuration cfg = getConfiguration();
executeSchema( cfg );
}
finally
{
currentThread.setContextClassLoader(oldClassLoader);
}
}
/**
* Method that does the real job
*/
protected abstract void executeSchema(Configuration cfg) throws Exception;
/**
*
*/
private Configuration getConfiguration() throws HibernateException
{
Configuration cfg = new Configuration();
if (getConfig() != null)
{
File f = new File(getConfig());
LOG.debug("Hibernate Configuration File: " + f.getAbsolutePath());
cfg.configure(f);
}
String[] files = getFileNames ();
for (int i = 0; i < files.length; i++)
{
String filename = files[i];
if (filename.endsWith(".jar"))
{
cfg.addJar(filename);
}
else
{
cfg.addFile(filename);
}
}
return cfg;
}
private String schemaOutputFile = null;
private String delimiter = null;
/**
* @return
*/
public String getSchemaOutputFile() {
return schemaOutputFile;
}
/**
* @return
*/
public String getOutputFile() {
return schemaOutputFile;
}
/**
* @return
*/
public String getDelimiter() {
return delimiter;
}
/**
* @param string
*/
public void setSchemaOutputFile(String string) {
schemaOutputFile = string;
}
/**
* @param string
*/
public void setOutputFile(String string) {
schemaOutputFile = string;
}
/**
* @param string
*/
public void setDelimiter(String string) {
delimiter = string;
}
}

View File

@@ -1,80 +0,0 @@
package org.apache.maven.hibernate.beans;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.io.FileInputStream;
import java.util.Properties;
import net.sf.hibernate.cfg.Configuration;
import net.sf.hibernate.tool.hbm2ddl.SchemaExport;
/**
*
* The Bean which serves as Proxy To Hibernate API
* <br/>
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
*/
public class SchemaExportBean extends SchemaBeanBase
{
private boolean drop = false;
/**
* @return
*/
public boolean isDrop()
{
return drop;
}
/**
* @param b
*/
public void setDrop(boolean b)
{
drop = b;
}
protected void executeSchema(Configuration cfg) throws Exception {
SchemaExport schemaExport = null;
if (getProperties() == null)
{
schemaExport = new SchemaExport(cfg);
}
else
{
Properties properties = new Properties();
properties.load(new FileInputStream(getProperties()));
schemaExport = new SchemaExport(cfg, properties);
}
LOG.debug("Output file:" + getOutputFile());
schemaExport.setOutputFile(getOutputFile());
schemaExport.setDelimiter(getDelimiter());
if (isDrop())
{
schemaExport.drop(!getQuiet(), !getText());
}
else
{
schemaExport.create(!getQuiet(), !getText());
}
}
}

View File

@@ -1,52 +0,0 @@
package org.apache.maven.hibernate.beans;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.io.FileInputStream;
import java.util.Properties;
import net.sf.hibernate.cfg.Configuration;
import net.sf.hibernate.tool.hbm2ddl.SchemaUpdate;
/**
*
* The Bean which serves as Proxy To Hibernate SchemaUpdate
* <br/>
*
* @author <a href="maven@felipeal.net">Felipe Leme</a>
* @version $Id$
*/
public class SchemaUpdateBean extends SchemaBeanBase
{
protected void executeSchema(Configuration cfg) throws Exception {
SchemaUpdate schemaUpdate = null;
if (getProperties() == null)
{
schemaUpdate = new SchemaUpdate(cfg);
}
else
{
Properties properties = new Properties();
properties.load(new FileInputStream(getProperties()));
schemaUpdate = new SchemaUpdate(cfg, properties);
}
schemaUpdate.execute( !getQuiet(), !getText() );
}
}

View File

@@ -1,93 +0,0 @@
package org.apache.maven.hibernate.jelly;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import org.apache.commons.jelly.*;
import org.apache.maven.hibernate.beans.MappingsAggregatorBean;
public class AggregateMappingsTag extends TagSupport
{
private MappingsAggregatorBean bean = new MappingsAggregatorBean();
protected void execute()
throws JellyTagException
{
try
{
bean.execute();
}
catch(Exception e)
{
String msg = " Mapping aggreagtion failed: " + e.getMessage();
throw new JellyTagException(msg, e);
}
}
public void doTag(XMLOutput arg0)
throws JellyTagException
{
execute();
}
public String toString()
{
return bean.toString();
}
public void setExcludes(String string)
{
bean.setExcludes(string);
}
public void setIncludes(String string)
{
bean.setIncludes(string);
}
public String getExcludes()
{
return bean.getExcludes();
}
public String getIncludes()
{
return bean.getIncludes();
}
public String getBasedir()
{
return bean.getBasedir();
}
public void setBasedir(String string)
{
bean.setBasedir(string);
}
public String getAggregateOutputFile()
{
return bean.getAggregateOutputFile();
}
public void setAggregateOutputFile(String aggregateOutputFile)
{
bean.setAggregateOutputFile(aggregateOutputFile);
}
}

View File

@@ -1,99 +0,0 @@
package org.apache.maven.hibernate.jelly;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import org.apache.maven.hibernate.beans.CodeGenerationBean;
/**
* @author <a href="paulkearney@gmail.com">Paul Kearney</a>
* @version $Id$
*/
public class CodeGenerationTag extends TagSupport {
private CodeGenerationBean bean = new CodeGenerationBean();
/**
* @see org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput)
*/
public void doTag(XMLOutput arg0) throws MissingAttributeException, JellyTagException {
execute();
}
/**
*
*/
protected void execute() throws JellyTagException
{
try {
bean.execute();
} catch (Exception e) {
String msg = "Code generation operation failed";
throw new JellyTagException(msg, e);
}
}
public String getBasedir()
{
return bean.getBasedir();
}
public String getExcludes()
{
return bean.getExcludes();
}
public String getIncludes()
{
return bean.getIncludes();
}
public String getOutputdir()
{
return bean.getOutputdir();
}
public void setBasedir(String string)
{
bean.setBasedir(string);
}
public void setExcludes(String string)
{
bean.setExcludes(string);
}
public void setIncludes(String string)
{
bean.setIncludes(string);
}
public void setOutputdir(String dir)
{
bean.setOutputdir(dir);
}
public String toString()
{
return bean.toString();
}
}

View File

@@ -1,42 +0,0 @@
package org.apache.maven.hibernate.jelly;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import org.apache.commons.jelly.tags.core.CoreTagLibrary;
/**
* Hibernate tag library.
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
*/
public class HibernateTagLibrary extends CoreTagLibrary
{
/**
* Create an instance of the {@link HibernateTagLibrary}, registering related
* tag libraries
*/
public HibernateTagLibrary()
{
registerTag( "schema-export", SchemaExportTag.class );
registerTag( "schema-update", SchemaUpdateTag.class );
registerTag( "aggregate-mappings", AggregateMappingsTag.class );
registerTag( "code-generation", CodeGenerationTag.class );
}
}

View File

@@ -1,66 +0,0 @@
package org.apache.maven.hibernate.jelly;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import org.apache.maven.hibernate.beans.SchemaExportBean;
/**
*
* Jelly tag which delagates all calls to {@link SchemaExportBean}
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
*/
public class SchemaExportTag extends SchemaTagBase
{
public SchemaExportTag() {
super( new SchemaExportBean() );
}
public void setDrop(boolean b)
{
((SchemaExportBean) bean).setDrop(b);
}
public void setOutputFile(String string)
{
bean.setOutputFile(string);
}
public void setDelimiter(String delimiter)
{
bean.setDelimiter(delimiter);
}
public boolean isDrop()
{
return ((SchemaExportBean) bean).isDrop();
}
public String getOutputFile()
{
return bean.getOutputFile();
}
public String getDelimiter()
{
return bean.getDelimiter();
}
}

View File

@@ -1,199 +0,0 @@
package org.apache.maven.hibernate.jelly;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import org.apache.maven.hibernate.beans.SchemaBeanBase;
/**
*
* Base class for Jelly tags that uses Hibernate's Schema classes
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @author <a href="maven@felipeal.net">Felipe Leme</a>
* @version $Id$
*/
public abstract class SchemaTagBase extends TagSupport
{
protected final SchemaBeanBase bean;
protected SchemaTagBase( SchemaBeanBase b ) {
bean = b;
}
/**
*
*/
protected void execute() throws JellyTagException
{
try
{
bean.execute();
}
catch (Exception e)
{
String msg = "Schema operation failed";
throw new JellyTagException(msg, e);
}
}
/**
* @see org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput)
*/
public void doTag(XMLOutput arg0) throws JellyTagException
{
execute();
}
/**
* @return
*/
public boolean getText()
{
return bean.getText();
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString()
{
return bean.toString();
}
/**
* @return
*/
public boolean getQuiet()
{
return bean.getQuiet();
}
/**
* @param string
*/
public void setExcludes(String string)
{
bean.setExcludes(string);
}
/**
* @param string
*/
public void setIncludes(String string)
{
bean.setIncludes(string);
}
/**
* @return
*/
public String getExcludes()
{
return bean.getExcludes();
}
/**
* @param string
*/
public void setConfig(String string)
{
bean.setConfig(string);
}
/**
* @return
*/
public String getIncludes()
{
return bean.getIncludes();
}
/**
* @return
*/
public String getBasedir()
{
return bean.getBasedir();
}
/**
* @return
*/
public String getProperties()
{
return bean.getProperties();
}
/**
* @return
*/
public String getConfig()
{
return bean.getConfig();
}
/**
* @param b
*/
public void setText(boolean b)
{
bean.setText(b);
}
/**
* @param string
*/
public void setBasedir(String string)
{
bean.setBasedir(string);
}
/**
* @param b
*/
public void setQuiet(boolean b)
{
bean.setQuiet(b);
}
/**
* @param string
*/
public void setProperties(String string)
{
bean.setProperties(string);
}
/**
*/
public String getSchemaOutputFile() {
return bean.getSchemaOutputFile();
}
/**
*/
public void setSchemaOutputFile(String string) {
bean.setSchemaOutputFile(string);
}
}

View File

@@ -1,36 +0,0 @@
package org.apache.maven.hibernate.jelly;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import org.apache.maven.hibernate.beans.SchemaUpdateBean;
/**
*
* Jelly tag which delagates all calls to {@link SchemaUpdateBean}
*
* @author <a href="maven@felipeal.net">Felipe Leme</a>
* @version $Id$
*/
public class SchemaUpdateTag extends SchemaTagBase
{
public SchemaUpdateTag() {
super( new SchemaUpdateBean() );
}
}

View File

@@ -1,536 +0,0 @@
<!-- Hibernate Mapping DTD.
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
An instance of this XML document may contain mappings for an arbitrary
number of classes. The class mappings may contain associations to classes
mapped in the same document or in another document. No class may be
mapped more than once. Each document may also contain definitions of an
arbitrary number of queries, and import declarations of arbitrary classes.
-->
<!-- The document root. -->
<!ELEMENT hibernate-mapping (meta*, import*, (class|subclass|joined-subclass)*, query*, sql-query*)>
<!ATTLIST hibernate-mapping schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST hibernate-mapping default-cascade (none|save-update|all) "none">
<!ATTLIST hibernate-mapping default-access CDATA "property">
<!ATTLIST hibernate-mapping auto-import (true|false) "true">
<!ATTLIST hibernate-mapping package CDATA #IMPLIED> <!-- default: none -->
<!-- An explicit query language "import" -->
<!ELEMENT import EMPTY>
<!ATTLIST import class CDATA #REQUIRED>
<!ATTLIST import rename CDATA #IMPLIED> <!-- default: unqualified class name -->
<!-- Root of an entity class hierarchy. Entities have their own tables. -->
<!ELEMENT class (
meta*,
(cache|jcs-cache)?,
(id|composite-id),
discriminator?,
(version|timestamp)?,
(property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|idbag|array|primitive-array)*,
((subclass*)|(joined-subclass*))
)>
<!ATTLIST class name CDATA #REQUIRED>
<!ATTLIST class table CDATA #IMPLIED> <!-- default: unqualified classname -->
<!ATTLIST class schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST class proxy CDATA #IMPLIED> <!-- default: no proxy interface -->
<!ATTLIST class discriminator-value CDATA #IMPLIED> <!-- default: unqualified class name | none -->
<!ATTLIST class mutable (true|false) "true">
<!ATTLIST class polymorphism (implicit|explicit) "implicit">
<!ATTLIST class where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST class persister CDATA #IMPLIED>
<!ATTLIST class dynamic-update (true|false) "false">
<!ATTLIST class dynamic-insert (true|false) "false">
<!ATTLIST class batch-size CDATA "1">
<!ATTLIST class select-before-update (true|false) "false">
<!ATTLIST class optimistic-lock (none|version|dirty|all) "version">
<!ATTLIST class lazy (true|false) #IMPLIED>
<!ATTLIST class check CDATA #IMPLIED> <!-- default: none -->
<!-- Declares the id type, column and generation algorithm for an entity class.
If a name attribut is given, the id is exposed to the application through the
named property of the class. If not, the id is only exposed to the application
via Session.getIdentifier() -->
<!ELEMENT id (meta*, column*, generator)>
<!ATTLIST id name CDATA #IMPLIED>
<!ATTLIST id access CDATA #IMPLIED>
<!ATTLIST id column CDATA #IMPLIED>
<!ATTLIST id type CDATA #IMPLIED>
<!ATTLIST id length CDATA #IMPLIED>
<!ATTLIST id unsaved-value CDATA "null"> <!-- any|none|null|0|-1|... -->
<!-- A composite key may be modelled by a java class with a property for each
key column. The class must implement java.io.Serializable and reimplement equals()
and hashCode(). -->
<!ELEMENT composite-id ( meta*, (key-property|key-many-to-one)+ )>
<!ATTLIST composite-id class CDATA #IMPLIED>
<!ATTLIST composite-id name CDATA #IMPLIED>
<!ATTLIST composite-id access CDATA #IMPLIED>
<!ATTLIST composite-id unsaved-value (any|none) "none">
<!-- Polymorphic data requires a column holding a class discriminator value. This
value is not directly exposed to the application. -->
<!ELEMENT discriminator (column?)>
<!ATTLIST discriminator column CDATA #IMPLIED> <!-- default: "class"|none -->
<!ATTLIST discriminator type CDATA "string">
<!ATTLIST discriminator not-null (true|false) "true">
<!ATTLIST discriminator length CDATA #IMPLIED>
<!ATTLIST discriminator force (true|false) "false">
<!-- Versioned data requires a column holding a version number. This is exposed to the
application through a property of the Java class. -->
<!ELEMENT version (meta*)>
<!ATTLIST version name CDATA #REQUIRED>
<!ATTLIST version access CDATA #IMPLIED>
<!ATTLIST version column CDATA #IMPLIED>
<!ATTLIST version type CDATA "integer">
<!ATTLIST version unsaved-value (null|negative|undefined) "undefined">
<!ELEMENT timestamp (meta*)>
<!ATTLIST timestamp name CDATA #REQUIRED>
<!ATTLIST timestamp column CDATA #IMPLIED>
<!ATTLIST timestamp access CDATA #IMPLIED>
<!ATTLIST timestamp unsaved-value (null|undefined) "null">
<!-- Subclass declarations are nested beneath the root class declaration to achieve
polymorphic persistence. -->
<!ELEMENT subclass (
meta*,
(property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|idbag|array|primitive-array)*,
subclass*
)>
<!ATTLIST subclass name CDATA #REQUIRED>
<!ATTLIST subclass proxy CDATA #IMPLIED> <!-- default: no proxy interface -->
<!ATTLIST subclass discriminator-value CDATA #IMPLIED> <!-- default: unqualified class name | none -->
<!ATTLIST subclass dynamic-update (true|false) "false">
<!ATTLIST subclass dynamic-insert (true|false) "false">
<!ATTLIST subclass extends CDATA #IMPLIED> <!-- default: empty when a toplevel, otherwise the nearest class definition -->
<!ATTLIST subclass lazy (true|false) #IMPLIED>
<!ATTLIST subclass persister CDATA #IMPLIED>
<!-- Joined subclasses are used for the normalized table-per-subclass mapping strategy -->
<!ELEMENT joined-subclass (
meta*,
key,
(property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|idbag|array|primitive-array)*,
joined-subclass*
)>
<!ATTLIST joined-subclass name CDATA #REQUIRED>
<!ATTLIST joined-subclass proxy CDATA #IMPLIED> <!-- default: no proxy interface -->
<!ATTLIST joined-subclass table CDATA #IMPLIED> <!-- default: unqualified class name -->
<!ATTLIST joined-subclass schema CDATA #IMPLIED>
<!ATTLIST joined-subclass dynamic-update (true|false) "false">
<!ATTLIST joined-subclass dynamic-insert (true|false) "false">
<!ATTLIST joined-subclass extends CDATA #IMPLIED> <!-- default: empty when a toplevel, otherwise the nearest class definition -->
<!ATTLIST joined-subclass lazy (true|false) #IMPLIED>
<!ATTLIST joined-subclass persister CDATA #IMPLIED>
<!ATTLIST joined-subclass check CDATA #IMPLIED> <!-- default: none -->
<!-- Property of an entity class or component, component-element, composite-id, etc.
JavaBeans style properties are mapped to table columns. -->
<!ELEMENT property (meta*,column*)>
<!ATTLIST property name CDATA #REQUIRED>
<!ATTLIST property access CDATA #IMPLIED>
<!ATTLIST property type CDATA #IMPLIED>
<!ATTLIST property column CDATA #IMPLIED>
<!ATTLIST property length CDATA #IMPLIED>
<!ATTLIST property not-null (true|false) "false">
<!ATTLIST property unique (true|false) "false">
<!ATTLIST property update (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST property insert (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST property formula CDATA #IMPLIED> <!-- only supported for properties of a class (not component) -->
<!-- Declares an association between two entities (Or from a component, component element,
etc. to an entity). -->
<!ELEMENT many-to-one (meta*,column*)>
<!ATTLIST many-to-one name CDATA #REQUIRED>
<!ATTLIST many-to-one access CDATA #IMPLIED>
<!ATTLIST many-to-one class CDATA #IMPLIED>
<!ATTLIST many-to-one column CDATA #IMPLIED>
<!ATTLIST many-to-one not-null (true|false) "false">
<!ATTLIST many-to-one unique (true|false) "false">
<!ATTLIST many-to-one cascade (none|all|save-update|delete) #IMPLIED> <!-- default: none -->
<!ATTLIST many-to-one outer-join (true|false|auto) "auto">
<!ATTLIST many-to-one update (true|false) "true"> <!-- only supported for many-to-one of a class (not component) -->
<!ATTLIST many-to-one insert (true|false) "true"> <!-- only supported for many-to-one of a class (not component) -->
<!ATTLIST many-to-one foreign-key CDATA #IMPLIED>
<!ATTLIST many-to-one property-ref CDATA #IMPLIED>
<!-- Declares a one-to-one association between two entities (Or from a component,
component element, etc. to an entity). -->
<!ELEMENT one-to-one (meta*)>
<!ATTLIST one-to-one name CDATA #REQUIRED>
<!ATTLIST one-to-one access CDATA #IMPLIED>
<!ATTLIST one-to-one class CDATA #IMPLIED>
<!ATTLIST one-to-one cascade (none|all|save-update|delete) #IMPLIED> <!-- default: none -->
<!ATTLIST one-to-one outer-join (true|false|auto) "auto">
<!ATTLIST one-to-one constrained (true|false) "false">
<!ATTLIST one-to-one foreign-key CDATA #IMPLIED>
<!ATTLIST one-to-one property-ref CDATA #IMPLIED>
<!-- A property embedded in a composite identifier or map index (always not-null). -->
<!ELEMENT key-property (meta*,column*)>
<!ATTLIST key-property name CDATA #REQUIRED>
<!ATTLIST key-property access CDATA #IMPLIED>
<!ATTLIST key-property type CDATA #IMPLIED>
<!ATTLIST key-property column CDATA #IMPLIED>
<!ATTLIST key-property length CDATA #IMPLIED>
<!-- A many-to-one association embedded in a composite identifier or map index
(always not-null, never cascade). -->
<!ELEMENT key-many-to-one (meta*,column*)>
<!ATTLIST key-many-to-one name CDATA #REQUIRED>
<!ATTLIST key-many-to-one access CDATA #IMPLIED>
<!ATTLIST key-many-to-one class CDATA #IMPLIED>
<!ATTLIST key-many-to-one column CDATA #IMPLIED>
<!ATTLIST key-many-to-one foreign-key CDATA #IMPLIED>
<!-- An "any" association is a polymorphic association to any table with
the given identifier type. The first listed column is a VARCHAR column
holding the name of the class (for that row). -->
<!ELEMENT any (meta*,meta-value*,column,column+)>
<!ATTLIST any id-type CDATA #REQUIRED>
<!ATTLIST any meta-type CDATA #IMPLIED> <!--- default: Hibernate.CLASS -->
<!ATTLIST any name CDATA #REQUIRED>
<!ATTLIST any access CDATA #IMPLIED>
<!ATTLIST any cascade (none|save-update|all) "none">
<!ELEMENT meta-value EMPTY>
<!ATTLIST meta-value value CDATA #REQUIRED>
<!ATTLIST meta-value class CDATA #REQUIRED>
<!-- A component is a user-defined class, persisted along with its containing entity
to the table of the entity class. JavaBeans style properties of the component are
mapped to columns of the table of the containing entity. A null component reference
is mapped to null values in all columns and vice versa. Components do not support
shared reference semantics. -->
<!ELEMENT component (
meta*,
parent?,
(property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|array|primitive-array)*
)>
<!ATTLIST component class CDATA #IMPLIED>
<!ATTLIST component name CDATA #REQUIRED>
<!ATTLIST component access CDATA #IMPLIED>
<!ATTLIST component update (true|false) "true">
<!ATTLIST component insert (true|false) "true">
<!ELEMENT dynamic-component (
(property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|array|primitive-array)*
)>
<!ATTLIST dynamic-component name CDATA #REQUIRED>
<!ATTLIST dynamic-component access CDATA #IMPLIED>
<!ATTLIST dynamic-component update (true|false) "true">
<!ATTLIST dynamic-component insert (true|false) "true">
<!-- The parent element maps a property of the component class as a pointer back to
the owning entity. -->
<!ELEMENT parent EMPTY>
<!ATTLIST parent name CDATA #REQUIRED>
<!-- Collection declarations nested inside a class declaration indicate a foreign key
relationship from the collection table to the enclosing class. -->
<!ELEMENT map (
meta*,
(cache|jcs-cache)?,
key,
(index|composite-index|index-many-to-many|index-many-to-any),
(element|one-to-many|many-to-many|composite-element|many-to-any)
)>
<!ATTLIST map name CDATA #REQUIRED>
<!ATTLIST map access CDATA #IMPLIED>
<!ATTLIST map table CDATA #IMPLIED> <!-- default: name -->
<!ATTLIST map schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST map lazy (true|false) "false">
<!ATTLIST map inverse (true|false) "false">
<!ATTLIST map sort CDATA "unsorted"> <!-- unsorted|natural|"comparator class", default: unsorted -->
<!ATTLIST map cascade (none|all|save-update|delete|all-delete-orphan|delete-orphan) #IMPLIED> <!-- default: none -->
<!ATTLIST map order-by CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST map where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST map batch-size CDATA "1">
<!ATTLIST map outer-join (true|false|auto) "auto">
<!ATTLIST map check CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST map persister CDATA #IMPLIED>
<!ELEMENT set (
meta*,
(cache|jcs-cache)?,
key,
(element|one-to-many|many-to-many|composite-element|many-to-any)
)>
<!ATTLIST set name CDATA #REQUIRED>
<!ATTLIST set access CDATA #IMPLIED>
<!ATTLIST set table CDATA #IMPLIED> <!-- default: name -->
<!ATTLIST set schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST set lazy (true|false) "false">
<!ATTLIST set sort CDATA "unsorted"> <!-- unsorted|natural|"comparator class" -->
<!ATTLIST set inverse (true|false) "false">
<!ATTLIST set cascade (none|all|save-update|delete|all-delete-orphan|delete-orphan) #IMPLIED> <!-- default: none -->
<!ATTLIST set order-by CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST set where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST set batch-size CDATA "1">
<!ATTLIST set outer-join (true|false|auto) "auto">
<!ATTLIST set persister CDATA #IMPLIED>
<!ATTLIST set check CDATA #IMPLIED> <!-- default: none -->
<!ELEMENT bag (
meta*,
(cache|jcs-cache)?,
key,
(element|one-to-many|many-to-many|composite-element|many-to-any)
)>
<!ATTLIST bag name CDATA #REQUIRED>
<!ATTLIST bag access CDATA #IMPLIED>
<!ATTLIST bag table CDATA #IMPLIED> <!-- default: name -->
<!ATTLIST bag schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST bag lazy (true|false) "false">
<!ATTLIST bag inverse (true|false) "false">
<!ATTLIST bag cascade (none|all|save-update|delete|all-delete-orphan|delete-orphan) #IMPLIED> <!-- default: none -->
<!ATTLIST bag order-by CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST bag where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST bag batch-size CDATA "1">
<!ATTLIST bag outer-join (true|false|auto) "auto">
<!ATTLIST bag persister CDATA #IMPLIED>
<!ATTLIST bag check CDATA #IMPLIED> <!-- default: none -->
<!ELEMENT idbag (
meta*,
(cache|jcs-cache)?,
collection-id,
key,
(element|many-to-many|composite-element|many-to-any)
)>
<!ATTLIST idbag name CDATA #REQUIRED>
<!ATTLIST idbag access CDATA #IMPLIED>
<!ATTLIST idbag table CDATA #IMPLIED> <!-- default: name -->
<!ATTLIST idbag schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST idbag lazy (true|false) "false">
<!ATTLIST idbag cascade (none|all|save-update|delete|all-delete-orphan|delete-orphan) #IMPLIED> <!-- default: none -->
<!ATTLIST idbag order-by CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST idbag where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST idbag batch-size CDATA "1">
<!ATTLIST idbag outer-join (true|false|auto) "auto">
<!ATTLIST idbag persister CDATA #IMPLIED>
<!ATTLIST idbag check CDATA #IMPLIED> <!-- default: none -->
<!ELEMENT list (
meta*,
(cache|jcs-cache)?,
key,
index,
(element|one-to-many|many-to-many|composite-element|many-to-any)
)>
<!ATTLIST list name CDATA #REQUIRED>
<!ATTLIST list access CDATA #IMPLIED>
<!ATTLIST list table CDATA #IMPLIED> <!-- default: name -->
<!ATTLIST list schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST list lazy (true|false) "false">
<!ATTLIST list inverse (true|false) "false">
<!ATTLIST list cascade (none|all|save-update|delete|all-delete-orphan|delete-orphan) #IMPLIED> <!-- default: none -->
<!ATTLIST list where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST list batch-size CDATA "1">
<!ATTLIST list outer-join (true|false|auto) "auto">
<!ATTLIST list persister CDATA #IMPLIED>
<!ATTLIST list check CDATA #IMPLIED> <!-- default: none -->
<!ELEMENT array (
meta*,
(cache|jcs-cache)?,
key,
index,
(element|one-to-many|many-to-many|composite-element|many-to-any)
)>
<!ATTLIST array name CDATA #REQUIRED>
<!ATTLIST array access CDATA #IMPLIED>
<!ATTLIST array table CDATA #IMPLIED> <!-- default: name -->
<!ATTLIST array schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST array inverse (true|false) "false">
<!ATTLIST array element-class CDATA #IMPLIED>
<!ATTLIST array cascade (none|all|save-update|delete) #IMPLIED> <!-- default: none -->
<!ATTLIST array where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST array batch-size CDATA "1">
<!ATTLIST array outer-join (true|false|auto) "auto">
<!ATTLIST array persister CDATA #IMPLIED>
<!ATTLIST array check CDATA #IMPLIED> <!-- default: none -->
<!ELEMENT primitive-array (meta*, (cache|jcs-cache)?, key, index, element)>
<!ATTLIST primitive-array name CDATA #REQUIRED>
<!ATTLIST primitive-array access CDATA #IMPLIED>
<!ATTLIST primitive-array table CDATA #IMPLIED> <!-- default: name -->
<!ATTLIST primitive-array schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST primitive-array where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST primitive-array batch-size CDATA "1">
<!ATTLIST primitive-array outer-join (true|false|auto) "auto">
<!ATTLIST primitive-array persister CDATA #IMPLIED>
<!ATTLIST primitive-array check CDATA #IMPLIED> <!-- default: none -->
<!-- Declares the element type of a collection of basic type -->
<!ELEMENT element (column*)>
<!ATTLIST element column CDATA #IMPLIED>
<!ATTLIST element type CDATA #REQUIRED>
<!ATTLIST element length CDATA #IMPLIED>
<!ATTLIST element not-null (true|false) "false">
<!ATTLIST element unique (true|false) "false">
<!-- One to many association. This tag declares the entity-class
element type of a collection and specifies a one-to-many relational model -->
<!ELEMENT one-to-many EMPTY>
<!ATTLIST one-to-many class CDATA #REQUIRED>
<!-- No column declaration attributes required in this case. The primary
key column of the associated class is already mapped elsewhere.-->
<!-- Many to many association. This tag declares the entity-class
element type of a collection and specifies a many-to-many relational model -->
<!ELEMENT many-to-many (meta*,column*)>
<!ATTLIST many-to-many class CDATA #REQUIRED>
<!ATTLIST many-to-many column CDATA #IMPLIED>
<!ATTLIST many-to-many outer-join (true|false|auto) "auto">
<!ATTLIST many-to-many foreign-key CDATA #IMPLIED>
<!-- unique makes no sense here since it would make the association one-to-many -->
<!-- A composite element allows a collection to hold instances of an arbitrary
class, without the requirement of joining to an entity table. Composite elements
have component semantics - no shared references and ad hoc null value semantics.
Composite elements may not hold nested collections. -->
<!ELEMENT composite-element (
(meta*),
parent?,
(property|many-to-one|any|nested-composite-element)*
)>
<!ATTLIST composite-element class CDATA #REQUIRED>
<!ELEMENT nested-composite-element (
(meta*),
parent?,
(property|many-to-one|any|nested-composite-element)*
)>
<!ATTLIST nested-composite-element class CDATA #REQUIRED>
<!ATTLIST nested-composite-element name CDATA #REQUIRED>
<!ATTLIST nested-composite-element access CDATA #IMPLIED>
<!-- Declares the column name of a foreign key. -->
<!ELEMENT key (column*)>
<!ATTLIST key column CDATA #IMPLIED>
<!ATTLIST key foreign-key CDATA #IMPLIED>
<!-- Declares the type and column mapping for a collection index (array or
list index, or key of a map). -->
<!ELEMENT index (column*)>
<!ATTLIST index column CDATA #IMPLIED>
<!ATTLIST index type CDATA #IMPLIED> <!-- required for maps -->
<!ATTLIST index length CDATA #IMPLIED>
<!-- Many to many association mapped to the key of a map. ie. a map keyed
on entities. -->
<!ELEMENT index-many-to-many (column*)>
<!ATTLIST index-many-to-many class CDATA #REQUIRED>
<!ATTLIST index-many-to-many column CDATA #IMPLIED>
<!ATTLIST index-many-to-many foreign-key CDATA #IMPLIED>
<!-- Composite index of a map ie. a map keyed on components. -->
<!ELEMENT composite-index ( (key-property|key-many-to-one)+ )>
<!ATTLIST composite-index class CDATA #REQUIRED>
<!-- A "many to any" defines a polymorphic association to any table
with the given identifier type. The first listed column is a VARCHAR column
holding the name of the class (for that row). -->
<!ELEMENT many-to-any (meta-value*,column, column+)>
<!ATTLIST many-to-any id-type CDATA #REQUIRED>
<!ATTLIST many-to-any meta-type CDATA #IMPLIED> <!--- default: Hibernate.CLASS -->
<!ELEMENT index-many-to-any (column, column+)>
<!ATTLIST index-many-to-any id-type CDATA #REQUIRED>
<!ATTLIST index-many-to-any meta-type CDATA #IMPLIED> <!--- default: Hibernate.CLASS -->
<!ELEMENT collection-id (meta*, column*, generator)>
<!ATTLIST collection-id column CDATA #REQUIRED>
<!ATTLIST collection-id type CDATA #REQUIRED>
<!ATTLIST collection-id length CDATA #IMPLIED>
<!-- Generators generate unique identifiers. The class attribute specifies a Java
class implementing an id generation algorithm. -->
<!ELEMENT generator (param*)>
<!ATTLIST generator class CDATA #REQUIRED>
<!ELEMENT param (#PCDATA)>
<!ATTLIST param name CDATA #REQUIRED>
<!-- The column element is an alternative to column attributes and required for
mapping associations to classes with composite ids. -->
<!ELEMENT column EMPTY>
<!ATTLIST column name CDATA #REQUIRED>
<!ATTLIST column length CDATA #IMPLIED> <!-- default: 255 -->
<!ATTLIST column not-null (true|false) #IMPLIED> <!-- default: false (except for id properties) -->
<!ATTLIST column unique (true|false) #IMPLIED> <!-- default: false (except for id properties) -->
<!ATTLIST column unique-key CDATA #IMPLIED> <!-- default: no unique key -->
<!ATTLIST column sql-type CDATA #IMPLIED> <!-- override default column type for hibernate type -->
<!ATTLIST column index CDATA #IMPLIED>
<!ATTLIST column check CDATA #IMPLIED> <!-- default: none -->
<!-- The cache or jcs-cache element enables caching of an entity class. -->
<!ELEMENT cache EMPTY>
<!ATTLIST cache usage (read-only|read-write|nonstrict-read-write|transactional) #REQUIRED>
<!ELEMENT jcs-cache EMPTY>
<!ATTLIST jcs-cache usage (read-only|read-write|nonstrict-read-write|transactional) #REQUIRED> <!-- deprecated -->
<!-- The query element declares a named Hibernate query string -->
<!ELEMENT query (#PCDATA)>
<!ATTLIST query name CDATA #REQUIRED>
<!-- The sql-query element declares a named SQL query string -->
<!ELEMENT return EMPTY>
<!ATTLIST return alias CDATA #REQUIRED>
<!ATTLIST return class CDATA #REQUIRED>
<!ELEMENT synchronize EMPTY>
<!ATTLIST synchronize table CDATA #REQUIRED>
<!ELEMENT sql-query (#PCDATA|return|synchronize)*>
<!ATTLIST sql-query name CDATA #REQUIRED>
<!-- The meta element is used to assign meta-level attributes to a class or property.
Is currently used by codegenerator as a placeholder for values that is not directly
related to OR mappings. -->
<!ELEMENT meta (#PCDATA)>
<!ATTLIST meta attribute CDATA #REQUIRED>
<!ATTLIST meta inherit (true|false) "true">

View File

@@ -1,62 +0,0 @@
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project xmlns:util="jelly:util"
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:assert="assert"
xmlns:maven="jelly:maven"
xmlns:x="jelly:xml"
default="testPlugin">
<goal name="testPlugin" prereqs="test-hibernate-code-generation">
<attainGoal name="clean"/>
</goal>
<goal name="test-hibernate-code-generation">
<!-- definitions -->
<j:set var="maven.hibernate.codeGeneration.input.excludes" value="org/apache/maven/hibernate/Item.hbm.xml,org/apache/maven/hibernate/ExcludeItem.hbm.xml"/>
<j:set var="itemJavaPath" value="org/apache/maven/hibernate/Item.java"/>
<j:set var="itemJavaFullPath" value="${maven.hibernate.codeGeneration.input.dir}/${itemJavaPath}"/>
<j:set var="excludeItemJavaPath" value="org/apache/maven/hibernate/ExcludeItem.java"/>
<j:set var="excludeItemJavaFullPath" value="${maven.hibernate.codeGeneration.input.dir}/${excludeItemJavaPath}"/>
<j:set var="messageJavaFullPath" value="${maven.hibernate.codeGeneration.output.dir}/org/apache/maven/hibernate/Message.java"/>
<!-- makes sure there was an Item.java before -->
<assert:assertFileExists file="${itemJavaFullPath}"/>
<util:loadText var="preItemContent" file="${itemJavaFullPath}"/>
<attainGoal name="hibernate:code-generation"/>
<util:loadText var="postItemContent" file="${itemJavaFullPath}"/>
<!-- makes sure Item.java was not generated -->
<assert:assertEquals expected="${preItemContent}" value="${postItemContent}"/>
<!-- makes sure ExcludeItem.java was not generated -->
<assert:assertFileNotFound file="${excludeItemJavaFullPath}"/>
<!-- makes sure Message.java was generated -->
<assert:assertFileExists file="${messageJavaFullPath}"/>
<attainGoal name="java:compile"/>
<delete file="${messageJavaFullPath}"/>
</goal>
</project>

View File

@@ -1,20 +0,0 @@
# -------------------------------------------------------------------
# Copyright 2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
maven.hibernate.quiet=false
maven.hibernate.codeGeneration.input.dir=${maven.src.dir}/main
maven.hibernate.codeGeneration.output.dir=${maven.hibernate.codeGeneration.input.dir}

View File

@@ -1,102 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project>
<pomVersion>3</pomVersion>
<id>test-maven-hibernate-plugin-codeGenerationTest</id>
<name>Test Cases for Maven Hibernate Plugin's CodeGeneration Tag</name>
<groupId>maven</groupId>
<currentVersion>1.0-SNAPSHOT</currentVersion>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
<logo>http://maven.apache.org/images/jakarta-logo-blue.gif</logo>
</organization>
<inceptionYear>2005</inceptionYear>
<package>org.apache.maven</package>
<logo>http://maven.apache.org/images/maven.jpg</logo>
<description>Test for Maven Hibernate plugin</description>
<shortDescription>Test for Maven Hibernate plugin</shortDescription>
<url>http://maven.apache.org/maven-1.x/reference/plugins/hibernate/</url>
<siteDirectory>/www/maven.apache.org/maven-1.x/reference/plugins/hibernate/</siteDirectory>
<repository>
<connection>scm:svn:http://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk/hibernate/src/plugin-test</connection>
<url>http://svn.apache.org/viewcvs.cgi/maven/maven-1/plugins/trunk/hibernate/src/plugin-test</url>
</repository>
<developers>
<developer>
<name>Felipe Leme</name>
<id>felipeal</id>
<email>maven@felipeal.net</email>
<organization>Falcon Informatica</organization>
<roles>
<role>Java Developer</role>
</roles>
<timezone>-3</timezone>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-xml</artifactId>
<version>1.1</version>
<url>http://jakarta.apache.org/commons/jelly/libs/xml/</url>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.7.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>2.1.3</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.0.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.4</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.0</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main</sourceDirectory>
<resources>
<resource>
<directory>src/main</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
</project>

View File

@@ -1,21 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="org.apache.maven.hibernate.ExcludeItem"
table="EXCLUDE_ITEMS">
<id
name="id"
type="java.lang.Long"
column="EXCLUDE_ITEM_ID">
<generator class="increment"/>
</id>
<property
name="name"
type="java.lang.String"
column="EXCLUDE_ITEM_NAME"/>
</class>
</hibernate-mapping>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping auto-import="false">
<class name="org.apache.maven.hibernate.Item" table="Item" >
<id name="id" type="int" column="ID" unsaved-value="0">
<generator class="native"/>
</id>
<property name="name" column="NAME" type="string"/>
</class>
</hibernate-mapping>

View File

@@ -1,56 +0,0 @@
package org.apache.maven.hibernate;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
/**
* Class to use with testing the plugin.
*
* @author <a href="mailto:epugh@opensourceconnections.com">Eric Pugh</a>
*
* @version $Id: Item.java 125453 2005-01-18 01:03:25Z felipeal $
*/
public class Item {
private int id;
private String name;
/**
* @return Returns the id.
*/
public int getId() {
return id;
}
/**
* @param id The id to set.
*/
public void setId(int id) {
this.id = id;
}
/**
* @return Returns the name.
*/
public String getName() {
return name;
}
/**
* @param name The name to set.
*/
public void setName(String name) {
this.name = name;
}
}

View File

@@ -1,30 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="org.apache.maven.hibernate.Message"
table="MESSAGES">
<id
name="id"
type="java.lang.Long"
column="MESSAGE_ID">
<generator class="increment"/>
</id>
<property
name="text"
type="org.apache.maven.hibernate.UserType"
column="FIELD_TEXT"/>
<property
name="field"
type="java.lang.String"
column="MESSAGE_TEXT"/>
<many-to-one
name="nextMessage"
class="org.apache.maven.hibernate.Message"
cascade="all"
column="NEXT_MESSAGE_ID"/>
</class>
</hibernate-mapping>

View File

@@ -1,41 +0,0 @@
package org.apache.maven.hibernate;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
/**
* Class to use with testing the plugin.
*
* @author <a href="paulkearney@gmail.com">Paul Kearney</a>
*
* @version $Id$
*/
public class UserType {
private Long field;
private Message message;
public Long getField() {
return field;
}
public void setField(Long field) {
this.field = field;
}
}

View File

@@ -1,26 +0,0 @@
<!--
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project
xmlns:maven="jelly:maven"
default="testPlugin">
<goal name="testPlugin">
<maven:reactor basedir="${basedir}" includes="*Test/project.xml" goals="testPlugin" banner="Test" ignoreFailures="false"/>
</goal>
</project>

View File

@@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project>
<pomVersion>3</pomVersion>
<name>Test project for Maven Hibernate Plugin</name>
<groupId>maven</groupId>
<currentVersion>1.0</currentVersion>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
<logo>http://maven.apache.org/images/apache-maven-project.png</logo>
</organization>
<inceptionYear>2001</inceptionYear>
<package>org.apache.maven</package>
<logo>http://maven.apache.org/images/maven.gif</logo>
<description>Test for Maven Hibernate plugin</description>
<shortDescription>Test for Maven Hibernate plugin</shortDescription>
<url>http://maven.apache.org/maven-1.x/reference/plugins/hibernate/</url>
<siteDirectory>/www/maven.apache.org/maven-1.x/reference/plugins/hibernate/</siteDirectory>
<repository>
<connection>scm:svn:http://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk/hibernate/</connection>
<url>http://svn.apache.org/viewcvs.cgi/maven/maven-1/plugins/trunk/hibernate/</url>
</repository>
<developers>
<developer>
<name>Felipe Leme</name>
<id>felipeal</id>
<email>maven@felipeal.net</email>
<organization>Falcon Informatica</organization>
<roles>
<role>Java Developer</role>
</roles>
<timezone>-3</timezone>
</developer>
</developers>
</project>

View File

@@ -1,92 +0,0 @@
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project xmlns:util="jelly:util"
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:assert="assert"
xmlns:maven="jelly:maven"
xmlns:x="jelly:xml"
default="testPlugin">
<goal name="testPlugin" prereqs="testSchemaExport,testSchemaUpdate,testAggregate">
<attainGoal name="clean"/>
</goal>
<goal name="testSchemaExport" prereqs="test-hibernate-schema-export-properties,test-hibernate-schema-export-configuration"/>
<goal name="testSchemaUpdate" prereqs="test-hibernate-schema-update-properties,test-hibernate-schema-update-configuration"/>
<goal name="testAggregate" prereqs="test-hibernate-aggregate-mappings"/>
<goal name="test-hibernate-schema-export-properties">
<j:set var="maven.hibernate.properties" value="${basedir}/src/main/hibernate.properties" />
<attainGoal name="clean"/>
<attainGoal name="jar"/>
<attainGoal name="hibernate:schema-export"/>
<assert:assertFileExists file="${maven.hibernate.output.file}"/>
</goal>
<goal name="test-hibernate-schema-export-configuration">
<j:set var="maven.hibernate.config" value="${basedir}/target/classes/hibernate.cfg.xml" />
<attainGoal name="clean"/>
<attainGoal name="jar"/>
<attainGoal name="hibernate:schema-export"/>
<assert:assertFileExists file="${maven.hibernate.output.file}"/>
</goal>
<goal name="test-hibernate-schema-update-properties">
<j:set var="maven.hibernate.properties" value="${basedir}/src/main/hibernate.properties" />
<attainGoal name="clean"/>
<attainGoal name="jar"/>
<attainGoal name="hibernate:schema-update"/>
<!-- unfortunately goal does not generate a file output, so we cannot assert anything -->
</goal>
<goal name="test-hibernate-schema-update-configuration">
<j:set var="maven.hibernate.config" value="${basedir}/target/classes/hibernate.cfg.xml" />
<attainGoal name="clean"/>
<attainGoal name="jar"/>
<attainGoal name="hibernate:schema-update"/>
<!-- unfortunately goal does not generate a file output, so we cannot assert anything -->
</goal>
<goal name="test-hibernate-aggregate-mappings">
<j:if test="${maven.mode.online}">
<j:set var="maven.hibernate.input.dir" value="${maven.build.dest},${basedir}/src/etc" />
<attainGoal name="jar"/>
<attainGoal name="hibernate:aggregate-mappings"/>
<assert:assertFileExists file="${maven.hibernate.aggregate.output.file}"/>
<!-- Verify that that files from both base directories are present -->
<util:file var="rawFile" name="${maven.hibernate.aggregate.output.file}"/>
<x:parse var="doc" xml="${rawFile}"/>
<x:set var="count" select="count($doc//hibernate-mapping//class)"/>
<assert:assertEquals expected="2" value="${count.intValue().toString()}"/>
</j:if>
</goal>
</project>

View File

@@ -1,17 +0,0 @@
# -------------------------------------------------------------------
# Copyright 2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
maven.hibernate.quiet=false

View File

@@ -1,105 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project>
<pomVersion>3</pomVersion>
<id>test-maven-hibernate-plugin-simpleTest</id>
<name>Simple Test Cases for Maven Hibernate</name>
<groupId>maven</groupId>
<currentVersion>1.0-SNAPSHOT</currentVersion>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
<logo>http://maven.apache.org/images/jakarta-logo-blue.gif</logo>
</organization>
<inceptionYear>2001</inceptionYear>
<package>org.apache.maven</package>
<logo>http://maven.apache.org/images/maven.jpg</logo>
<description>Test for Maven Hibernate plugin</description>
<shortDescription>Test for Maven Hibernate plugin</shortDescription>
<url>http://maven.apache.org/maven-1.x/reference/plugins/hibernate/</url>
<siteDirectory>/www/maven.apache.org/maven-1.x/reference/plugins/hibernate/</siteDirectory>
<repository>
<connection>scm:svn:http://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk/hibernate/src/plugin-test</connection>
<url>http://svn.apache.org/viewcvs.cgi/maven/maven-1/plugins/trunk/hibernate/src/plugin-test</url>
</repository>
<developers>
<developer>
<name>Eric Pugh</name>
<id>epugh</id>
<email>epugh@opensourceconnections.com</email>
<organization>OpenSource Connections</organization>
<roles>
<role>Developer</role>
</roles>
</developer>
<developer>
<name>Felipe Leme</name>
<id>felipeal</id>
<email>maven@felipeal.net</email>
<organization>Falcon Informatica</organization>
<roles>
<role>Java Developer</role>
</roles>
<timezone>-3</timezone>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-xml</artifactId>
<version>1.1</version>
<url>http://jakarta.apache.org/commons/jelly/libs/xml/</url>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.7.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>2.1.3</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.0.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.4</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main</sourceDirectory>
<resources>
<resource>
<directory>src/main</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
</project>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping auto-import="false">
<class name="org.apache.maven.hibernate.Component" table="Component" >
<id name="id" type="int" column="ID" unsaved-value="0">
<generator class="native"/>
</id>
<property name="name" column="NAME" type="string"/>
</class>
</hibernate-mapping>

View File

@@ -1,25 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<!-- shared properties -->
<session-factory>
<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.url">jdbc:hsqldb:.</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>
<property name="connection.pool_size">0</property>
<property name="show_sql">false</property>
<property name="dialect">net.sf.hibernate.dialect.HSQLDialect</property>
<mapping resource="org/apache/maven/hibernate/Item.hbm.xml"/>
</session-factory>
</hibernate-configuration>

View File

@@ -1,5 +0,0 @@
hibernate.dialect net.sf.hibernate.dialect.HSQLDialect
hibernate.connection.driver_class org.hsqldb.jdbcDriver
hibernate.connection.username sa
hibernate.connection.password
hibernate.connection.url jdbc:hsqldb:.

View File

@@ -1,56 +0,0 @@
package org.apache.maven.hibernate;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
/**
* Class to use with testing the plugin.
*
* @author <a href="mailto:epugh@opensourceconnections.com">Eric Pugh</a>
*
* @version $Id$
*/
public class Component {
private int id;
private String name;
/**
* @return Returns the id.
*/
public int getId() {
return id;
}
/**
* @param id The id to set.
*/
public void setId(int id) {
this.id = id;
}
/**
* @return Returns the name.
*/
public String getName() {
return name;
}
/**
* @param name The name to set.
*/
public void setName(String name) {
this.name = name;
}
}

View File

@@ -1,33 +0,0 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping auto-import="false">
<class name="org.apache.maven.hibernate.Item" table="Item" >
<id name="id" type="int" column="ID" unsaved-value="0">
<generator class="native"/>
</id>
<property name="name" column="NAME" type="string"/>
</class>
</hibernate-mapping>

View File

@@ -1,56 +0,0 @@
package org.apache.maven.hibernate;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
/**
* Class to use with testing the plugin.
*
* @author <a href="mailto:epugh@opensourceconnections.com">Eric Pugh</a>
*
* @version $Id$
*/
public class Item {
private int id;
private String name;
/**
* @return Returns the id.
*/
public int getId() {
return id;
}
/**
* @param id The id to set.
*/
public void setId(int id) {
this.id = id;
}
/**
* @return Returns the name.
*/
public String getName() {
return name;
}
/**
* @param name The name to set.
*/
public void setName(String name) {
this.name = name;
}
}

View File

@@ -1,80 +0,0 @@
package org.apache.maven.hibernate;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import junit.framework.TestCase;
/**
* Test cases for the {@link HibernateEntityResolver}. Based heavily
* on J2EEEntityResolver.
*
* @author <a href="mailto:epugh@opnesourceconnections.com">Eric Pugh</a>
* @version $Id$
*/
public class HibernateEntityResolverTest extends TestCase
{
/** instance for unit testing */
private HibernateEntityResolver instance;
/**
* Creates a new instance of J2EEEntityResolverTest
* @param testName the name of the test
*/
public HibernateEntityResolverTest(String testName)
{
super(testName);
}
/**
* Initialize per test data
* @throws Exception when there is an unexpected problem
*/
public void setUp() throws Exception
{
instance = new HibernateEntityResolver();
}
/**
* Test that all public ids are available and being found
*/
public void testAllAvailable()
{
assertNotNull("id to resource map not available", instance.getIdToResource());
int numDTDs = HibernateEntityResolver.HIBERNATE_DTDS.length;
assertEquals("wrong number of entries", numDTDs, instance.getIdToResource().size());
for (int i = 0; i < numDTDs; i++)
{
assertNotNull("Can't find resource for publicId",
instance.getIdToResource().get(HibernateEntityResolver.HIBERNATE_DTDS[i]));
}
}
/**
* Test that the resolver is getting resources locally
*/
public void testResolvingLocally() throws Exception
{
int numDTDs = HibernateEntityResolver.HIBERNATE_DTDS.length;
for (int i = 0; i < numDTDs; i++)
{
String publicId = HibernateEntityResolver.HIBERNATE_DTDS[i];
assertNotNull("Can't find resource for publicId " + publicId,
instance.resolveEntity(publicId, null));
}
}
}

View File

@@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>Changes</title>
<author email="michal.maczka@dimatics.com">Michal Maczka</author>
</properties>
<body>
<release version="1.4-SNAPSHOT" date="In SVN">
<action dev="aheritier" type="update" issue="MAVEN-1712">Update dependencies to match ones in maven 1.1 core and to unify them between plugins. The following dependencies are updated :
<ul>
<li>ant v1.5.3-1 -> v1.6.5</li>
<li>commons-collections v2.1 -> v3.0</li>
<li>commons-jelly v1.0-beta-4 -> v1.0</li>
<li>commons-logging v1.0.3 -> v1.0.4</li>
<li>log4j v1.2.8 -> v1.2.12</li>
<li>xercesImpl v 2.4.0 -> v2.6.2</li>
<li>xml-apis v 1.0.b2 -> xmlParserAPIs v2.6.2</li>
</ul>
</action>
</release>
<release version="1.3" date="2005-02-10">
<action dev="felipeal" type="add" issue="MPHIBERNATE-12" due-to="Paul Kearney">Added new goal
<code>hibernate:code-generation</code>.
</action>
<action dev="felipeal" type="add" issue="MPHIBERNATE-13">Added new goal
<code>hibernate:schema-update</code>.
</action>
<action dev="epugh" type="fix" issue="MPHIBERNATE-9">plugin:test fails without a network connection.</action>
</release>
<release version="1.2" date="2004-08-14">
<action dev="epugh" type="fix" issue="MPHIBERNATE-10" due-to="Henning Schmiedehausen">maven-hibernate ignores the "config" attribute</action>
<action dev="epugh" type="fix" issue="MPHIBERNATE-11" due-to="Henning Schmiedehausen">maven-hibernate needs cglib when sending SQL directly to the database</action>
<action dev="epugh" type="fix" issue="MPHIBERNATE-7" due-to="Dion Gillard">Unit tests only functioned from the /src/plugin-test directory. plugin:test fails</action>
<action dev="epugh" type="add" issue="MPHIBERNATE-6" due-to="Alex Shnyderman">New aggregate-mappings goal to aggregate multiple .hbm files into one file.</action>
<action dev="epugh" type="add" issue="MPHIBERNATE-6" due-to="Alex Shnyderman">Added multiple base directories for mapping files</action>
<action dev="epugh" type="update">Update to hibernate-2.1.3.</action>
</release>
<release version="1.1" date="2004-05-15">
<action dev="brett" type="fix" issue="MPHIBERNATE-2">Fix class not found exception by using correct base class loader.</action>
</release>
<release version="1.0" date="2004-03-11">
<action dev="k8n" type="update">Update to hibernate-2.0.3. Add delimiter property to schema-export tag</action>
<action dev="dion" type="update">update to commons-jelly-20030902.160215</action>
<action dev="dion" type="update">Upgrade to dom4j 1.4</action>
<action dev="dion" type="update">Upgrade to dom4j 1.4-dev-8</action>
<action dev="dion" type="update">Upgrade to commons-logging 1.0.3</action>
<action dev="michal" type="add">Initial plugin created</action>
</release>
</body>
</document>

View File

@@ -1,62 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>Hibernate Plugin Goals</title>
<author email="michal.maczka@dimatics.com">Michal Maczka</author>
</properties>
<body>
<section name="Goals">
<table>
<tr><th>Goal</th><th>Description</th></tr>
<tr>
<td>hibernate:schema-export<a name="hibernate:schema-export" /></td>
<td>
Creates SQL DDL file and generates the database schema from set of *.hbm.xml files
</td>
</tr>
<tr>
<td>hibernate:schema-update<a name="hibernate:schema-update" /></td>
<td>
Updates the database schema based on the set of *.hbm.xml files
</td>
</tr>
<tr>
<td>hibernate:aggregate-mappings<a name="hibernate:aggregate-mappings" /></td>
<td>
Aggregates multiple hibernate mappings into one
</td>
</tr>
<tr>
<td>hibernate:code-generation<a name="hibernate:code-generation" /></td>
<td>
Generates Java classes from set of *.hbm.xml files
</td>
</tr>
</table>
</section>
</body>
</document>

View File

@@ -1,37 +0,0 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>Maven Hibernate Plug-in</title>
<author email="michal.maczka@dimatics.com">Michal Maczka</author>
</properties>
<body>
<section name="Maven Hibernate Plug-in">
<p>
This plugin provides easy integration with
<a href="http://www.hibernate.org/">Hibernate 2.x</a> for your project.
<br/>
For the moment the functionality is very limited.
</p>
</section>
</body>
</document>

View File

@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project name="Maven Hibernate Plugin">
<title>Maven Hibernate Plugin</title>
<body>
<breadcrumbs>
<item name="Apache" href="http://www.apache.org"/>
<item name="Maven" href="http://maven.apache.org/"/>
<item name="Maven 1.x" href="http://maven.apache.org/maven-1.x/"/>
</breadcrumbs>
<links>
<item name="Maven 1.x plugins" href="http://maven.apache.org/maven-1.x/reference/plugins/index.html"/>
<item name="Maven 1.x plugins Sandbox" href="http://maven.apache.org/maven-1.x/plugins-sandbox/index.html"/>
<item name="Continuum" href="http://maven.apache.org/continuum/index.html"/>
<item name="Maven 2.0" href="http://maven.apache.org/"/>
<item name="Hibernate" href="http://www.hibernate.org"/>
</links>
<menu name="Overview">
<item name="Goals" href="/goals.html"/>
<item name="Properties" href="/properties.html"/>
</menu>
</body>
</project>

View File

@@ -1,179 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>Hibernate Settings</title>
<author email="michal.maczka@dimatics.com">Michal Maczka</author>
</properties>
<body>
<section name="Hibernate Settings">
<table>
<tr><th>Property</th><th>Optional?</th><th>Description</th></tr>
<tr>
<td>maven.hibernate.properties</td>
<td>No</td>
<td>
The location of Hibernate configuration file
(Java properties file). This file is also set in the
runtime by Hibernate for configuring Hibernate Session,
so it's better to keep it separately from the project's
configuration files like
<code>project.properties</code> etc.
<br/>
For description of the properties take a look
at <a href="http://www.hibernate.org/hib_docs/reference/en/html/session-configuration.html#configuration-hibernatejdbc">Hibernate User Guide</a>
</td>
</tr>
<tr>
<td>maven.hibernate.quiet</td>
<td>Yes</td>
<td>
Controls verbosity of the plugin.
Default is set to <code>yes</code>
</td>
</tr>
<tr>
<td>maven.hibernate.text</td>
<td>Yes</td>
<td>
It defaults to <code>no</code>. If set to true, then the
generated SQL will be output only to the filesystem, not
inserted into the database.
</td>
</tr>
<tr>
<td>maven.hibernate.drop</td>
<td>Yes</td>
<td>
Indicates whether to drop to generate just a drop table script.
<br/>
It defaults to <code>no</code>
</td>
</tr>
<tr>
<td>maven.hibernate.delimiter</td>
<td>Yes</td>
<td>String used to separate commands in SQL output.</td>
</tr>
<tr>
<td>maven.hibernate.output.dir</td>
<td>Yes</td>
<td>
The location of the directory where DDL SQL schema will
be generated by <code>schema-export</code> goal. It defaults to
<code>${maven.build.dir}/schema</code>
</td>
</tr>
<tr>
<td>maven.hibernate.output.file</td>
<td>Yes</td>
<td>
The name of the file which will be created by <code>schema-export</code>
goal. It defaults to
<code>${maven.hibernate.output.dir}/${maven.final.name}-schema.sql</code>.
</td>
</tr>
<tr>
<td>maven.hibernate.input.dir</td>
<td>Yes</td>
<td>
Comma-seperated list of base directories indicating where
mapping files are located. It defaults
to <code>${maven.build.dest}</code>.
</td>
</tr>
<tr>
<td>maven.hibernate.input.includes</td>
<td>Yes</td>
<td>
Comma-separated list of patterns of Hibernate mapping files,
which will be included during generation process.
<br/>
<b>Note</b>: Files are relative to
<code>${maven.hibernate.input.dir}</code>.
<br/>
By defaults all files are included:
<code>**/*.hbm.xml</code>.
</td>
</tr>
<tr>
<td>maven.hibernate.input.excludes</td>
<td>Yes</td>
<td>
Comma-separated list of patterns of Hibernate mapping files,
which will be excluded during generation process.
<br/>
<b>Note</b>: Files are relative to
<code>${maven.hibernate.input.dir}</code>.
<br/>
By default no files are excluded.
</td>
</tr>
<tr>
<td>maven.hibernate.aggregate.output.file</td>
<td>Yes</td>
<td>When <code>aggregate-mappings</code> is run, this file will contain the aggregated mappings</td>
</tr>
<tr>
<td>maven.hibernate.codeGeneration.input.dir</td>
<td>Yes</td>
<td>Comma-separated list of directories that contains Hibernate mapping files which will be used to generated Java classes when the goal <code>code-generation</code> is used.
It defaults to <code>${maven.src.dir}/hibernate</code>.
</td>
</tr>
<tr>
<td>maven.hibernate.codeGeneration.input.includes</td>
<td>Yes</td>
<td>
Comma-separated list of patterns of Hibernate mapping files,
which will be included during the code generation process (goal <code>code-generation</code>).
<br/>
<b>Note</b>: Files are relative to <code>${maven.hibernate.codeGeneration.input.dir}</code>.
<br/>
Default value is <code>${maven.hibernate.input.includes}</code>.
</td>
</tr>
<tr>
<td>maven.hibernate.codeGeneration.input.excludes</td>
<td>Yes</td>
<td>
Comma-separated list of patterns of Hibernate mapping files,
which will be excluded during the code generation process (goal <code>code-generation</code>).
<br/>
<b>Note</b>: Files are relative to
<code>${maven.hibernate.codeGeneration.input.dir}</code>.
<br/>
By default no files are excluded.
</td>
</tr>
<tr>
<td>maven.hibernate.codeGeneration.output.dir</td>
<td>Yes</td>
<td>When <code>code-generation</code> is run, the generated Java files will be placed in
this directory. It defaults to <code>${maven.src.dir}/hibernate</code>.</td>
</tr>
</table>
</section>
</body>
</document>

View File

@@ -1,69 +0,0 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project
xmlns:ant="jelly:ant"
xmlns:define="jelly:define"
xmlns:j="jelly:core"
xmlns:license="license"
xmlns:log="jelly:log"
xmlns:maven="jelly:maven"
xmlns:util="jelly:util">
<!-- ================================================================ -->
<!-- D E F A U L T G O A L -->
<!-- ================================================================ -->
<goal name="j2ee" prereqs="j2ee:validate-war"
description="Check that a war file is valid" />
<!-- ================================================================ -->
<!-- V A L I D A T E A W A R -->
<!-- ================================================================ -->
<goal name="j2ee:validate-war"
description="Check that a war file is valid">
<ant:taskdef name="warvalidator" classname="org.apache.maven.j2ee.WarValidator">
<ant:classpath>
<ant:pathelement path="${plugin.resources}" />
<ant:pathelement path="${plugin.dir}" />
<ant:pathelement path="${plugin.getDependencyPath('ant')}"/>
<ant:pathelement path="${plugin.getDependencyPath('dom4j')}"/>
<ant:pathelement path="${plugin.getDependencyPath('xerces:xmlParserAPIs')}"/>
<ant:pathelement path="${plugin.getDependencyPath('commons-logging')}"/>
</ant:classpath>
</ant:taskdef>
<maven:get var="warBuildDir" plugin="maven-war-plugin" property="maven.war.build.dir"/>
<maven:get var="warFinalName" plugin="maven-war-plugin" property="maven.war.final.name"/>
<ant:warvalidator warFileName="${warBuildDir}/${maven.war.final.name}">
<ant:formatter type="plain" usefile="false"/>
</ant:warvalidator>
</goal>
<define:taglib uri="j2ee">
<define:tag name="resolver">
<j:new var="resolver" className="org.apache.maven.j2ee.J2EEEntityResolver" />
<j:set var="${var}" value="${resolver}" scope="parent" />
</define:tag>
</define:taglib>
</project>

View File

@@ -1,21 +0,0 @@
# -------------------------------------------------------------------
# Copyright 2001-2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# P R O J E C T P R O P E R T I E S
# -------------------------------------------------------------------

View File

@@ -1,122 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project xmlns="http://maven.apache.org/POM/3.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/3.0.0 http://maven.apache.org/maven-v3_0_0.xsd">
<extend>../plugins-parent/project.xml</extend>
<pomVersion>3</pomVersion>
<id>maven-j2ee-plugin</id>
<name>Maven J2EE Plugin</name>
<currentVersion>1.6-SNAPSHOT</currentVersion>
<description/>
<shortDescription>J2EE tools</shortDescription>
<issueTrackingUrl>http://jira.codehaus.org/browse/MPJEE</issueTrackingUrl>
<versions>
<version>
<id>1.4</id>
<name>1.4</name>
<tag>MAVEN_J2EE_1_4</tag>
</version>
<version>
<id>1.5</id>
<name>1.5</name>
<tag>MAVEN_J2EE_1_5</tag>
</version>
<version>
<id>1.5.1</id>
<name>1.5.1</name>
<tag>MAVEN_J2EE_1_5_1</tag>
</version>
</versions>
<developers>
<developer>
<name>Peter Lynch</name>
<id>plynch</id>
<email>plynch@apache.org</email>
<organization/>
<roles>
<role>Java Developer</role>
</roles>
</developer>
<developer>
<name>Bob McWhirter</name>
<id>werken</id>
<email>bob@werken.com</email>
<organization>The Werken Company</organization>
<roles>
<role>Java Developer</role>
</roles>
</developer>
<developer>
<name>Stéphane Mor</name>
<id>smor</id>
<email>stephanemor@yahoo.fr</email>
<organization>Hasgard Systèmes et Réseaux</organization>
<roles>
<role>Java Developer</role>
</roles>
</developer>
<developer>
<name>Jason van Zyl</name>
<id>jvanzyl</id>
<email>jason@zenplex.com</email>
<organization>Zenplex</organization>
<roles>
<role>Architect</role>
<role>Release Manager</role>
</roles>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-log</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
<properties>
<comment>This library is already loaded by maven's core. Be careful to use the same version number as in the core.</comment>
</properties>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.4</version>
<properties>
<comment>This library is already loaded by maven's core. Be careful to use the same version number as in the core.</comment>
</properties>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xmlParserAPIs</artifactId>
<version>2.6.2</version>
<url>http://xerces.apache.org/xerces2-j/</url>
<properties>
<classloader>root</classloader>
</properties>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
</dependencies>
</project>

View File

@@ -1,115 +0,0 @@
package org.apache.maven.j2ee;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
* A class to resolve external entity definitions for j2ee artifacts.
*
* @author dion
* @version $Id$
*/
public class J2EEEntityResolver implements EntityResolver
{
/** map of ids to resource names */
private Map idToResource = new HashMap();
/** log for debug output */
private static final Log LOG = LogFactory.getLog(J2EEEntityResolver.class);
/** list of j2ee dtds that are being made available */
public static final String[] J2EE_DTDS = new String[] {
"-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.3//EN",
"-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN",
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN",
"-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN",
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN",
"-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
};
public static final String[] J2EE_RESOURCES = new String[] {
"/plugin-resources/application-client_1_3.dtd",
"/plugin-resources/application_1_3.dtd",
"/plugin-resources/ejb-jar_2_0.dtd",
"/plugin-resources/web-app_2.2.dtd",
"/plugin-resources/web-app_2_3.dtd",
"/plugin-resources/web-jsptaglibrary_1_2.dtd"
};
/** Creates a new instance of EntityResolver */
public J2EEEntityResolver()
{
for (int i = 0; i < J2EE_DTDS.length; i++) {
idToResource.put(J2EE_DTDS[i], J2EE_RESOURCES[i]);
}
}
/** resolve the entity given by the provided Ids
* @param publicId the public id of the entity
* @param systemId the 'system location' (typically a URL) of the entity
* @return an {@link InputSource input source} for retrieval of the entity
* @throws IOException when an I/O error occurs retrieving the entity
* @throws SAXException if there are any problems
*/
public InputSource resolveEntity(String publicId, String systemId) throws
SAXException, IOException
{
LOG.debug("resolving entity with publicId='" + publicId + ", systemId='" + systemId + "'");
if (publicId != null)
{
String resource = (String) idToResource.get(publicId);
LOG.debug("resource found in map ='" + resource + "'" );
if (resource != null)
{
InputStream in = getClass().getResourceAsStream(resource);
LOG.debug("input stream ='" + in + "'" );
if (in != null)
{
return new InputSource(in);
}
}
}
return null;
}
/** Getter for publicId to resource name map.
* @return Value of property idToResource.
*/
protected Map getIdToResource()
{
return idToResource;
}
/** Setter for publicId to resource name map.
* @param idToResource New value of property idToResource.
*/
protected void setIdToResource(Map idToResource)
{
this.idToResource = idToResource;
}
}

View File

@@ -1,137 +0,0 @@
package org.apache.maven.j2ee;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
*
* @version $Id$
* @author dion
*/
public class ValidationBroadcaster
{
/** {@link ValidationListeners} handled by this broadcaster */
private List listeners = new ArrayList();
/** Creates a new instance of ValidationBroadcaster */
public ValidationBroadcaster()
{
}
/**
* fire a {@link ValidationListener#validationStarted(ValidationEvent)
* started} event.
* @param event the event to broadcast
*/
public void fireStartedEvent(ValidationEvent event)
{
for (Iterator listeners = getListeners().iterator();
listeners.hasNext();)
{
((ValidationListener) listeners.next()).validationStarted(event);
}
}
/**
* fire an {@link ValidationListener#validationEnded(ValidationEvent)
* ended} event.
* @param event the event to broadcast
*/
public void fireEndedEvent(ValidationEvent event)
{
for (Iterator listeners = getListeners().iterator();
listeners.hasNext();)
{
((ValidationListener) listeners.next()).validationEnded(event);
}
}
/**
* fire an {@link ValidationListener#validationError(ValidationEvent)
* error} event.
* @param event the event to broadcast
*/
public void fireErrorEvent(ValidationEvent event)
{
for (Iterator listeners = getListeners().iterator();
listeners.hasNext();)
{
((ValidationListener) listeners.next()).validationError(event);
}
}
/**
* fire a {@link ValidationListener#validationWarning(ValidationEvent)
* warning} event.
* @param event the event to broadcast
*/
public void fireWarningEvent(ValidationEvent event)
{
for (Iterator listeners = getListeners().iterator();
listeners.hasNext();)
{
((ValidationListener) listeners.next()).validationWarning(event);
}
}
/**
* fire a {@link ValidationListener#validationInformation(ValidationEvent)
* information} event.
* @param event the event to broadcast
*/
public void fireInformationEvent(ValidationEvent event)
{
for (Iterator listeners = getListeners().iterator();
listeners.hasNext();)
{
((ValidationListener) listeners.next()).validationInformation(
event);
}
}
/** Getter for property listeners.
* @return Value of property listeners.
*/
private List getListeners()
{
return listeners;
}
/**
* add a listener to the list to be notified
* @param listener a {@link ValidationListener}
*/
public void addValidationListener(ValidationListener listener)
{
getListeners().add(listener);
}
/**
* remove a listener from the list to be notified
* @param listener a {@link ValidationListener}
*/
public void removeValidationListener(ValidationListener listener)
{
getListeners().remove(listener);
}
}

View File

@@ -1,101 +0,0 @@
package org.apache.maven.j2ee;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.util.EventObject;
/**
* A class that holds details about the validation
*
* @version $Id$
* @author dion
*/
public class ValidationEvent extends EventObject
{
/** A message describing the validation event that occurred */
private String message;
/** The thing being validated that the event relates to, e.g a WAR file */
private Object subject;
/**
* Creates a new instance of ValidationEvent.
*
* @param source the source of the event, some validator.
*/
public ValidationEvent(Object source)
{
this(source, null, null);
}
/**
* Creates a new instance of ValidationEvent.
*
* @param source the source of the event, some validator.
* @param subject the object being validated
* @param message the validation message
*/
public ValidationEvent(Object source, Object subject, String message)
{
super(source);
setSubject(subject);
setMessage(message);
}
/**
* Getter for property message.
*
* @return Value of property message.
*/
public String getMessage()
{
return message;
}
/**
* Setter for property message.
*
* @param message New value of property message.
*/
public void setMessage(String message)
{
this.message = message;
}
/**
* Getter for property subject.
*
* @return Value of property subject.
*/
public Object getSubject()
{
return subject;
}
/**
* Set the subject of the validation event.
*
* @param subject New value of property subject.
*/
public void setSubject(Object subject)
{
this.subject = subject;
}
}

View File

@@ -1,279 +0,0 @@
package org.apache.maven.j2ee;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;
/**
* Base class for formatters of validation events.
* Handles plain and xml formats.
*
* @version $Id$
* @author dion
*/
public class ValidationFormatter implements ValidationListener
{
/** Whether the formatter should write it's results to a file */
private boolean usefile;
/** name of the file (if usefile is true) to send output to */
private String file;
/** type of output: plain/xml */
private String type = ValidationFormatter.PLAIN;
/** Plain format output */
public static final String PLAIN = "plain";
/** xml format output */
public static final String XML = "xml";
/** output destination */
private PrintStream stream = null;
// --- Constructors --------------------------------------------------------
/**
* Creates a new instance of ValidationFormatter
*/
public ValidationFormatter()
{
stream = System.out;
}
// --- Methods -------------------------------------------------------------
/**
* Test whether the formatter is in plain mode.
*
* @return true if {@link #type} is set to {@link PLAIN}
*/
private boolean isPlain()
{
return ValidationFormatter.PLAIN.equals(getType());
}
/**
* Print an event in xml format
*
* @param event the event to print
* @param eventName started/ended/error etc
*/
private void printEventAsXML(ValidationEvent event, String eventName)
{
getStream().println("\t<" + eventName + ">");
getStream().println("\t\t<source>");
getStream().println("\t\t\t" + event.getSource());
getStream().println("\t\t</source>");
getStream().println("\t\t<subject>");
getStream().println("\t\t\t" + event.getSubject());
getStream().println("\t\t</subject>");
getStream().println("\t\t<message>");
getStream().println("\t\t\t" + event.getMessage());
getStream().println("\t\t</message>");
getStream().println("\t</" + eventName + ">");
}
/**
* Print an event in plain format
*
* @param event the {@link ValidationEvent event} to print
* @param type started, ended etc
*/
private void printEvent(String type, ValidationEvent event)
{
getStream().println(event.getSubject() + " " + type + ": "
+ event.getMessage());
}
/**
* Called when validation ends
*
* @param event a {@link ValidationEvent}
*/
public void validationEnded(ValidationEvent event)
{
if (isPlain())
{
printEvent("ended", event);
}
else
{
printEventAsXML(event, "ended");
getStream().println("</validation-report>");
}
}
/**
* Called when a validation error occurs. That is, the subject being
* validated has a serious (fatal) problem
*
* @param event a {@link ValidationEvent}
*/
public void validationError(ValidationEvent event)
{
if (isPlain())
{
printEvent("error", event);
}
else
{
printEventAsXML(event, "error");
}
}
/**
* Called when validation starts
*
* @param event a {@link ValidationEvent}
*/
public void validationStarted(ValidationEvent event)
{
if (isPlain())
{
printEvent("started", event);
}
else
{
getStream().println("<?xml version=\"1.0\" ?>");
getStream().println("<validation-report>");
printEventAsXML(event, "started");
}
}
/**
* Called when a validation warning occurs. That is, the subject being
* validated has a problem which may not be fatal
*
* @param event a {@link ValidationEvent}
*/
public void validationWarning(ValidationEvent event)
{
if (isPlain())
{
printEvent("warning", event);
}
else
{
printEventAsXML(event, "warning");
}
}
/**
* Called when validation information events are fired.
*
* @param event a {@link ValidationEvent}
*/
public void validationInformation(ValidationEvent event)
{
if (isPlain())
{
printEvent("info", event);
}
else
{
printEventAsXML(event, "info");
}
}
/**
* Getter for property file.
*
* @return Value of property file.
*/
public String getFile()
{
return file;
}
/**
* Setter for property file.
*
* @param file New value of property file.
* @throws FileNotFoundException if the named file doesn't exist
*/
public void setFile(String file) throws FileNotFoundException
{
this.file = file;
File theFile = new File(file);
File dir = theFile.getParentFile();
if (dir != null) {
dir.mkdirs();
}
FileOutputStream fos = new FileOutputStream(file);
stream = new PrintStream(fos);
}
/**
* Getter for property usefile.
*
* @return Value of property usefile.
*/
public boolean isUsefile()
{
return usefile;
}
/**
* Setter for property usefile.
*
* @param usefile New value of property usefile.
*/
public void setUsefile(boolean usefile)
{
this.usefile = usefile;
}
/**
* Getter for property stream.
*
* @return Value of property stream.
*/
public PrintStream getStream()
{
return stream;
}
/**
* Setter for property stream.
*
* @param stream New value of property stream.
*/
public void setStream(PrintStream stream)
{
this.stream = stream;
}
/**
* Getter for property type.
*
* @return Value of property type.
*/
public String getType()
{
return type;
}
/**
* Setter for property type.
*
* @param type New value of property type.
*/
public void setType(String type)
{
this.type = type;
}
}

View File

@@ -1,64 +0,0 @@
package org.apache.maven.j2ee;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.util.EventListener;
/**
* An interface implemented by those who want to receive validation events
* from a J2EE Validator (WAR, EAR etc).
*
* @version $Id$
* @author dion
*/
public interface ValidationListener extends EventListener
{
/**
* Called when validation starts
* @param event a {@link ValidationEvent}
*/
void validationStarted(ValidationEvent event);
/**
* Called when a validation error occurs. That is, the subject being
* validated has a serious (fatal) problem
* @param event a {@link ValidationEvent}
*/
void validationError(ValidationEvent event);
/**
* Called when a validation warning occurs. That is, the subject being
* validated has a problem which may not be fatal
* @param event a {@link ValidationEvent}
*/
void validationWarning(ValidationEvent event);
/**
* Called when validation information is provided. This may be any
* information the validator feels is relevant.
* @param event a {@link ValidationEvent}
*/
void validationInformation(ValidationEvent event);
/**
* Called when validation ends
* @param event a {@link ValidationEvent}
*/
void validationEnded(ValidationEvent event);
}

View File

@@ -1,205 +0,0 @@
package org.apache.maven.j2ee;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
/**
* A {@link ValidationListener} that tracks events and will provide a true/false
* response about the status of the validation.
*
* @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
* @version
* $Id$
*/
public class ValidationStatusListener implements ValidationListener
{
/** Whether the validation has started */
private boolean started = false;
/** Whether the validation has ended */
private boolean ended = false;
/** Whether the validation has had 1 or more errors */
private boolean error = false;
/** Whether the validation has had 1 or more warnings */
private boolean warning = false;
/** Whether the validation has had 1 or more info messages */
private boolean information = false;
/**
* Creates a new instance of ValidationStatusListener
*/
public ValidationStatusListener()
{
}
/**
* Called when a validation error occurs. That is, the subject being
* validated has a serious (fatal) problem. Sets the <code>error</code>
* property to <code>true</code>.
*
* @param event a {@link ValidationEvent}
*/
public void validationError(ValidationEvent event)
{
setError(true);
}
/**
* Called when a validation warning occurs. That is, the subject being
* validated has a problem which may not be fatal. Sets the
* <code>warning</code> property to <code>true</true>.
*
* @param event a {@link ValidationEvent}
*/
public void validationWarning(ValidationEvent event)
{
setWarning(true);
}
/**
* Called when validation info messages are issued. Sets the
* <code>information</code> property to <code>true</true>.
*
* @param event a {@link ValidationEvent}
*/
public void validationInformation(ValidationEvent event)
{
setInformation(true);
}
/**
* Called when validation starts. Sets the <code>started</code> property to
* <code>true</code>
*
* @param event a {@link ValidationEvent}
*/
public void validationStarted(ValidationEvent event)
{
setStarted(true);
}
/**
* Called when validation ends. Sets the <code>ended</code> property to
* <code>true</code>
*
* @param event a {@link ValidationEvent}
*/
public void validationEnded(ValidationEvent event)
{
setEnded(true);
}
/**
* Has validation ended?
*
* @return Value of property ended.
*/
public boolean isEnded()
{
return ended;
}
/**
* Sets whether validation has ended.
*
* @param ended New value of property ended.
*/
private void setEnded(boolean ended)
{
this.ended = ended;
}
/**
* Has a validation error occurred?
*
* @return Value of property error.
*/
public boolean isError()
{
return error;
}
/**
* Sets whether a validation error has occurred.
*
* @param error New value of property error.
*/
private void setError(boolean error)
{
this.error = error;
}
/**
* Has validation started?
*
* @return Value of property started.
*/
public boolean isStarted()
{
return started;
}
/**
* Sets whether validation has started
*
* @param started New value of property started.
*/
private void setStarted(boolean started)
{
this.started = started;
}
/**
* Has a validation warning occurred?
*
* @return Value of property warning.
*/
public boolean isWarning()
{
return warning;
}
/**
* Sets whether a validation warning has occurred.
*
* @param warning New value of property warning.
*/
private void setWarning(boolean warning)
{
this.warning = warning;
}
/**
* Gets whether an info message has been issued.
*
* @return Value of property information.
*/
public boolean isInformation()
{
return information;
}
/**
* Sets whether an info message has been issued.
*
* @param information New value of property information.
*/
public void setInformation(boolean information)
{
this.information = information;
}
}

View File

@@ -1,104 +0,0 @@
package org.apache.maven.j2ee;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.jar.JarEntry;
/**
* A {@link ClassLoader} that loads classes from a {@link WarFile}
*
* @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
* @version $Id$
*/
public class WarClassLoader extends URLClassLoader
{
/** temp files created by classloader */
private List tempFiles = new ArrayList();
/** war file to be used for class loading */
private WarFile war;
/**
* Creates a new instance of WarClassLoader
*
* @param war a {@link WarFile}
* @throws IOException when an I/O error occurs extracting the jars from the
* war
* @throws MalformedURLException if the jar: URL is not supported on the
* underlying platform
*/
public WarClassLoader(WarFile war) throws IOException, MalformedURLException
{
super (new URL[0]);
this.war = war;
addURLs();
}
/**
* Creates a new instance of WarClassLoader with the provided parent
* classloader as the one to delegate to if classes can't be found
*
* @param war a {@link WarFile}
* @param classloader a {@link ClassLoader} to delegate to.
* @throws IOException when an I/O error occurs extracting the jars from
* the war
* @throws MalformedURLException if the jar: URL is not supported on the
* underlying platform
*/
public WarClassLoader(WarFile war, ClassLoader classloader) throws
IOException, MalformedURLException
{
super(new URL[0], classloader);
this.war = war;
addURLs();
}
/**
* Add WEB-INF/classes and WEB-INF/lib/*.jar as extra classpath URLs
*
* @throws IOException when an I/O error occurs extracting the jars from
* the war
* @throws MalformedURLException if the jar: URL is not supported on the
* underlying platform
*/
private void addURLs() throws IOException, MalformedURLException
{
File warFile = new File(war.getName());
URL webInfClasses = new URL("jar:" + warFile.toURL() + "!/"
+ "WEB-INF/classes/");
addURL(webInfClasses);
Set jars = war.getLibEntries();
JarEntry entry = null;
for (Iterator jarEntries = jars.iterator(); jarEntries.hasNext();)
{
entry = (JarEntry) jarEntries.next();
File jar = war.extract(entry);
tempFiles.add(jar);
jar.deleteOnExit();
addURL(new URL("jar:" + jar.toURL() + "!/"));
}
}
}

View File

@@ -1,410 +0,0 @@
package org.apache.maven.j2ee;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import org.apache.maven.j2ee.war.FormLoginConfig;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Node;
import org.dom4j.io.SAXReader;
/**
* Represents a J2EE War File
*
* @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
* @version $Id$
*/
public class WarFile extends JarFile
{
/** web.xml entry in the war */
public static final String WEB_XML = "WEB-INF/web.xml";
/** lib entry in the war for jar files */
public static final String LIB = "WEB-INF/lib/";
/**
* Creates a new instance of WarFile
*
* @param name the {@link File file} name of a war file
* @throws IOException when an I/O error occurs
*/
public WarFile(String name) throws IOException
{
super(name);
}
/**
* Creates a new instance of WarFile
*
* @param name the {@link File file} name of a war file
* @param verify whether or not to verify the war file if it is signed
* @throws IOException when an I/O error occurs
*/
public WarFile(String name, boolean verify) throws IOException
{
super(name, verify);
}
/**
* Creates a new instance of WarFile
*
* @param warFile a J2EE .war {@link File file}
* @throws IOException when an I/O error occurs
*/
public WarFile(File warFile) throws IOException
{
super(warFile);
}
/**
* Creates a new instance of WarFile
*
* @param warFile a J2EE .war {@link File file}
* @param verify whether or not to verify the war file if it is signed
* @throws IOException when an I/O error occurs
*/
public WarFile(File warFile, boolean verify) throws IOException
{
super(warFile, verify);
}
/**
* Creates a new instance of WarFile
*
* @param warFile a J2EE .war {@link File file}
* @param verify whether or not to verify the war file if it is signed
* @param mode the mode in which the file is to be opened
* @throws IOException when an I/O error occurs
*/
public WarFile(File warFile, boolean verify, int mode) throws IOException
{
super(warFile, verify, mode);
}
/**
* Retrieves the WEB-INF/web.xml entry if it exists.
*
* @return a {@link JarEntry} for web.xml
*/
public JarEntry getWebXmlEntry()
{
return getJarEntry(WarFile.WEB_XML);
}
/**
* Get a map of servlet name -> servlet class. The map has a size of zero
* if there are no servlets or no web.xml in the war.
*
* @return a map of servlets held in the war.
* @throws IOException if there are problems reading from the war
*/
public Map getServlets() throws IOException
{
Map servlets = new HashMap();
if (getWebXmlEntry() != null)
{
Document webXml = getWebXml();
List servletNodes = webXml.selectNodes("//servlet");
Node node = null;
for (Iterator nodes = servletNodes.iterator(); nodes.hasNext();)
{
node = (Node) nodes.next();
String servletName = node.selectSingleNode("./servlet-name")
.getText();
Node servletClass = node.selectSingleNode("./servlet-class");
if (servletClass != null)
{
servlets.put(servletName, servletClass.getText());
}
}
}
return servlets;
}
/**
* Get a map of servlet name -> jsp file. The map has a size of zero
* if there are no jsp files defined or no web.xml in the war.
*
* @return a map of jsps defined using the <code>&lt;servlet&gt;</code> tag
* held in the war.
* @throws IOException if there are problems reading from the war
*/
public Map getJSPs() throws IOException
{
Map jsps = new HashMap();
if (getWebXmlEntry() != null)
{
Document webXml = getWebXml();
List servletNodes = webXml.selectNodes("//servlet");
Node node = null;
for (Iterator nodes = servletNodes.iterator(); nodes.hasNext();)
{
node = (Node) nodes.next();
String servletName = node.selectSingleNode("./servlet-name")
.getText();
Node jspFile = node.selectSingleNode("./jsp-file");
if (jspFile != null)
{
jsps.put(servletName, jspFile.getText());
}
}
}
return jsps;
}
/**
* Get a map of taglib-uri -> taglib-location. The map has zero size
* if there are no taglibs defined or no web.xml in the war
*
* @return a map of uri to location
* @throws IOException when an I/O error occurs reading the war
*/
public Map getTaglibs() throws IOException
{
Map taglibs = new HashMap();
if (getWebXmlEntry() != null)
{
Document webXml = getWebXml();
List taglibNodes = webXml.selectNodes("//taglib");
Node node = null;
for (Iterator nodes = taglibNodes.iterator(); nodes.hasNext();)
{
node = (Node) nodes.next();
String taglibUri = node.selectSingleNode("./taglib-uri")
.getText();
String taglibLocation = node.selectSingleNode(
"./taglib-location").getText();
taglibs.put(taglibUri, taglibLocation);
}
}
return taglibs;
}
/**
* Get the web.xml back as a dom4j Document, for easier processing
*
* @return a {@link Document} representing the web.xml
* @throws IOException if there are any issues reading the web.xml
* or producing the xml document
*/
protected Document getWebXml() throws IOException
{
if (getWebXmlEntry() == null)
{
throw new IOException("Attempted to get non-existent web.xml");
}
try
{
SAXReader xmlReader = new SAXReader(false);
xmlReader.setEntityResolver(new J2EEEntityResolver());
InputStream webXmlStream = getInputStream(getWebXmlEntry());
Document webXml = xmlReader.read(webXmlStream);
return webXml;
}
catch (DocumentException de)
{
de.printStackTrace();
throw new IOException(de.getMessage());
}
}
/**
* Provide a set of jar files as found in WEB-INF/lib
*
* @return a set of jar files as {@link JarEntry entries} from WEB-INF/lib
*/
public Set getLibEntries()
{
Set libs = new HashSet();
Enumeration entries = entries();
JarEntry entry = null;
while (entries.hasMoreElements())
{
entry = (JarEntry) entries.nextElement();
if (entry.getName().startsWith("WEB-INF/lib/")
&& entry.getName().toLowerCase().endsWith(".jar"))
{
libs.add(entry);
}
}
return libs;
}
/**
* Extract the given {@link JarEntry entry} to a temporary file
*
* @param entry a previously retrieved entry from the jar file
* @return the {@link File} created
* @throws IOException when an I/O error occurs reading the war
*/
public File extract(JarEntry entry) throws IOException
{
// expand to temp dir and add to list
File tempFile = File.createTempFile("maven", null);
// read from jar and write to the tempJar file
BufferedInputStream inStream = new BufferedInputStream(getInputStream(
entry));
BufferedOutputStream outStream = new BufferedOutputStream(
new FileOutputStream(tempFile));
int status = -1;
while ((status = inStream.read()) != -1)
{
outStream.write(status);
}
outStream.close();
inStream.close();
return tempFile;
}
/**
* Tests whether a 'file' exists in the war. A file in this case is
* a jar entry prefixed with a '/'. e.g. the file /WEB-INF/web.xml is
* the same as the jar entry WEB-INF/web.xml
*
* @param fileName an entry in the war to be searched for
* @return whether the entry exists
*/
public boolean hasFile(String fileName)
{
if (fileName == null)
{
throw new NullPointerException("fileName parameter can't be null");
}
String entryName = null;
if (fileName.startsWith("/"))
{
entryName = fileName.substring(1);
return getJarEntry(entryName) != null;
}
else
{
return false;
}
}
/**
* Get a map of error pages to error locations. The key of the map is
* either the <code>&lt;error-code&gt;</code> or <code>&lt;
* exception-type&gt;</code>, the value is <code>&lt;location&gt;</code>.
*
* @return a map of error page to error location
* @throws IOException if there are problems reading from the war
*/
public Map getErrorPages() throws IOException
{
Map errorPages = new HashMap();
if (getWebXmlEntry() != null)
{
Document webXml = getWebXml();
List errorNodes = webXml.selectNodes("//error-page");
Node node = null;
for (Iterator nodes = errorNodes.iterator(); nodes.hasNext();)
{
node = (Node) nodes.next();
Node errorCodeNode = node.selectSingleNode("./error-code");
Node exceptionTypeNode = node.selectSingleNode(
"./exception-type");
String location = node.selectSingleNode("./location").getText();
String key = null;
if (errorCodeNode == null)
{
key = exceptionTypeNode.getText();
}
else
{
key = errorCodeNode.getText();
}
errorPages.put(key, location);
}
}
return errorPages;
}
/**
* Get the <code>&lt;form-login-config&gt</code> details specified in the
* war file, or null if the element is not present
*
* @return a {@link FormLoginConfig} with the login and error pages
* @throws IOException if there are problems reading from the war
*/
public FormLoginConfig getFormLoginConfig() throws IOException
{
FormLoginConfig config = null;
if (getWebXmlEntry() != null)
{
Document webXml = getWebXml();
Node formLoginConfigNode = webXml.selectSingleNode(
"//form-login-config");
if (formLoginConfigNode != null)
{
String login = formLoginConfigNode.selectSingleNode(
"./form-login-page").getText();
String error = formLoginConfigNode.selectSingleNode(
"./form-error-page").getText();
config = new FormLoginConfig(login, error);
}
}
return config;
}
/**
* Get a map of servlet name -> url pattern for all defined servlets
*
* @return a map as specified
* @throws IOException if there are problems reading from the war
*/
public Map getServletMappings() throws IOException
{
Map mappings = new HashMap();
if (getWebXmlEntry() != null)
{
Document webXml = getWebXml();
List nodes = webXml.selectNodes("/web-app/servlet-mapping");
Node node = null;
for (int nodeIndex = 0; nodeIndex < nodes.size(); nodeIndex++)
{
node = (Node) nodes.get(nodeIndex);
String servletName = node.valueOf("./servlet-name");
String urlPattern = node.valueOf("./url-pattern");
mappings.put(servletName, urlPattern);
}
}
return mappings;
}
}

View File

@@ -1,503 +0,0 @@
package org.apache.maven.j2ee;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import org.apache.maven.j2ee.war.FormLoginConfig;
/**
* A task to validate a war file. The following is checked:
* <ol>
* <li>The war file exists</li>
* <li>The war file is readable</li>
* <li>The war file has a web.xml (warning)</li>
* <li>Servlets defined by a <code>&lt;servlet&gt;<code> tag are loadable
* from the war file and <strong>not</strong> the classpath</li>
* <li>JSPs defined by a <code>&lt;servlet&gt;<code> tag exist in the war
* </li>
* <li>Taglibs defined by a <code>&lt;taglib&gt;</code> have a <code>
* &lt;taglib-location&gt;</code> that exists in the war</li>
* <li>Error pages specified by a <code>&lt;location&gt;</code> nested
* within an <code>&lt;error-page&gt;</code> element must exist in the
* war file</li>
* <li>Login and error pages specified in the <code>&lt;form-login-config
* &gt;</code> element must exist in the war file</li>
* </ol>
* @author dIon Gillard
* @version $Id$
*/
public class WarValidator
{
/** name of the war file to be validated */
private String warFileName;
/** broadcaster to help with events */
private ValidationBroadcaster broadcaster = new ValidationBroadcaster();
/** status listener to keep track of errors etc */
private ValidationStatusListener status = new ValidationStatusListener();
/**
* whether or not the build process should fail if a validation error occurs
*/
private boolean failOnError = true;
//--- Constructors ---------------------------------------------------------
/**
* Creates a new instance of WarValidator
*/
public WarValidator()
{
addValidationListener(getStatus());
}
//--- Methods --------------------------------------------------------------
/**
* Provides access to the status listener that is automatically attached
* to the validation
*
* @return Value of property status.
*/
public ValidationStatusListener getStatus()
{
return status;
}
/**
* Perform the validation.
*
* @throws IllegalStateException when any error occurs
*/
public void execute()
{
if (getWarFileName() == null)
{
throw new NullPointerException("war file name should not be null");
}
validate();
if (getStatus().isError() && isFailOnError())
{
throw new IllegalStateException("Errors occurred during validation. "
+ "Messages should have been provided");
}
}
/**
* validate the provided war file
*/
public void validate()
{
try
{
startValidation();
validateFile();
if (!getStatus().isError())
{
validateWarContents();
}
}
finally
{
endValidation();
}
}
/**
* Start validation - issue a started event, and check the war file is
* ok from a filesystem perspective - exists and is readable
*/
protected void startValidation()
{
getBroadcaster().fireStartedEvent(new ValidationEvent(this,
getWarFileName(), "war validation started"));
}
/**
* Hook point for subclasses to add validations
*/
protected void validateWarContents()
{
validateWebXml();
}
/**
* End validation - fire an ended event
*/
protected void endValidation()
{
getBroadcaster().fireEndedEvent(new ValidationEvent(this,
getWarFileName(), "war validation ended"));
}
/**
* validate the war file can be read and exists
*/
private void validateFile()
{
File warFile = new File(getWarFileName());
if (!warFile.exists())
{
error("File does not exist");
return;
}
if (!warFile.canRead())
{
error("File can't be read");
return;
}
}
/**
* Validate the web.xml entry in the provided jar file.
*/
private void validateWebXml()
{
WarFile war = null;
try
{
war = new WarFile(getWarFileName());
if (war.getWebXmlEntry() == null)
{
warning("web.xml entry not found");
return;
}
validateServlets(war);
validateJSPs(war);
validateTaglibs(war);
validateErrorPages(war);
validateFormLoginConfig(war);
}
catch (IOException ioe)
{
error("Error opening war file for web.xml - possibly missing "
+ "manifest");
}
}
/**
* Validate the servlets defined in the war file (as defined by a
* <code>&lt;servlet&gt;</code> tag in web.xml), making sure that their
* class defined can be loaded from the war and is not part of the
* external classpath
*
* @param war the war file to validate
* @throws IOException when there are any issues reading the war file
*/
private void validateServlets(WarFile war) throws IOException
{
Map servlets = war.getServlets();
if (servlets.size() != 0)
{
ClassLoader classLoader = new WarClassLoader(war, getClass().
getClassLoader());
String className = null;
Map.Entry entry = null;
for (Iterator entries = servlets.entrySet().iterator();
entries.hasNext();)
{
entry = (Map.Entry) entries.next();
className = (String) entry.getValue();
info("validating servlet name: " + entry.getKey() + " class: "
+ className);
// check each servlet by loading the class
validateClass(className, classLoader);
}
}
}
/**
* Validate the jsps defined in the war file (as defined by a
* <code>&lt;servlet&gt;</code> tag with a nested <code>&lt;jsp-file&gt;
* </code> in web.xml), making sure that the resource specifed by
* <code>&lt;jsp-file&gt;</code> exists in the war file
*
* @param war the war file to validate
* @throws IOException when there are any issues reading the war file
*/
private void validateJSPs(WarFile war) throws IOException
{
Map jsps = war.getJSPs();
if (jsps.size() != 0)
{
Map.Entry entry = null;
for (Iterator entries = jsps.entrySet().iterator();
entries.hasNext();)
{
entry = (Map.Entry) entries.next();
String jspFile = (String) entry.getValue();
info("validating servlet name: " + entry.getKey()
+ " jsp file: " + jspFile);
if (!war.hasFile(jspFile))
{
error("JSP File: '" + jspFile + "' not found");
}
}
}
}
/**
* Validate that the given className can be loaded by the given
* {@link ClasssLoader}
*
* @param className the name of a class to attempt loading
* @param loader a {@link ClassLoader class loader}
*/
protected void validateClass(String className, ClassLoader loader)
{
try
{
Class clazz = loader.loadClass(className);
if (clazz.getClassLoader() != loader)
{
// loaded from classpath - a no no.
error("class (" + className + ") loaded from system classpath "
+ "rather than war file");
}
}
catch (ClassNotFoundException e)
{
error("class (" + className + ") not found ");
}
catch (NoClassDefFoundError error)
{
error("class (" + className + ") was found, but a referenced class "
+ "was missing: " + error.getMessage());
}
}
/**
* Validate the taglibs defined in the war file (as defined by a
* <code>&lt;taglib&gt;</code> tag in web.xml), making sure that the
* resource specifed by <code>&lt;taglib-location&gt;</code> exists in the
* war file
*
* @param war the war file to validate
* @throws IOException when there are any issues reading the war file
*/
private void validateTaglibs(WarFile war) throws IOException
{
Map taglibs = war.getTaglibs();
if (taglibs.size() != 0)
{
Map.Entry entry = null;
for (Iterator entries = taglibs.entrySet().iterator();
entries.hasNext();)
{
entry = (Map.Entry) entries.next();
String uri = (String) entry.getKey();
String location = (String) entry.getValue();
info("validating taglib uri: " + uri);
if (!war.hasFile(location))
{
error("Taglib location: '" + location + "' not found");
}
}
}
}
/**
* Validate the error pages defined in the war file (as defined by a
* <code>&lt;error-page&gt;</code> tag in web.xml), making sure that the
* location specifed by the nested <code>&lt;location&gt;</code> exists in
* the war file
*
* @param war the war file to validate
* @throws IOException when there are any issues reading the war file
*/
public void validateErrorPages(WarFile war) throws IOException
{
Map pages = war.getErrorPages();
if (pages.size() != 0)
{
Map.Entry entry = null;
for (Iterator entries = pages.entrySet().iterator();
entries.hasNext();)
{
entry = (Map.Entry) entries.next();
String errorQualifier = (String) entry.getKey();
String location = (String) entry.getValue();
info("validating error page for: " + errorQualifier);
if (!war.hasFile(location))
{
error("Error page location: '" + location + "' not found");
}
}
}
}
/**
* Validate that the <code>&lt;form-login-config&gt</code> element, if it
* exists contains valid login and error pages
*
* @param war the war file to validate
* @throws IOException when there are any issues reading the war file
*/
public void validateFormLoginConfig(WarFile war) throws IOException
{
FormLoginConfig config = war.getFormLoginConfig();
if (config != null)
{
if (!war.hasFile(config.getLoginPage()))
{
info("<form-config-login> login-page location: '"
+ config.getLoginPage() + "' not found");
}
if (!war.hasFile(config.getErrorPage()))
{
error("<form-config-login> error-page location: '"
+ config.getErrorPage() + "' not found");
}
}
}
/**
* add a listener to the list to be notified
*
* @param listener a {@link ValidationListener}
*/
public void addValidationListener(ValidationListener listener)
{
getBroadcaster().addValidationListener(listener);
}
/**
* remove a listener from the list to be notified
*
* @param listener a {@link ValidationListener}
*/
public void removeValidationListener(ValidationListener listener)
{
getBroadcaster().removeValidationListener(listener);
}
/**
* Getter for property warFileName.
*
* @return Value of property warFileName.
*/
public String getWarFileName()
{
return warFileName;
}
/**
* Setter for property warFileName.
*
* @param warFileName New value of property warFileName.
*/
public void setWarFileName(String warFileName)
{
this.warFileName = warFileName;
}
/**
* Getter for property broadcaster.
*
* @return Value of property broadcaster.
*/
protected ValidationBroadcaster getBroadcaster()
{
return broadcaster;
}
/**
* Add a formatter to pick up events and display the output.
* Used by ant when a nested formatter element is present.
*
* @param formatter a class to format validation events
*/
public void addFormatter(ValidationFormatter formatter)
{
addValidationListener((ValidationListener) formatter);
}
/**
* Provide a string representation of the validator
*
* @return "WarValidator(file)"
*/
public String toString()
{
StringBuffer buffer = new StringBuffer("WarValidator");
if (getWarFileName() != null)
{
buffer.append("(").append(getWarFileName()).append(")");
}
return buffer.toString();
}
/**
* Whether the build process will fail if a validation error occurs.
*
* @return Value of property failOnError.
*/
public boolean isFailOnError()
{
return failOnError;
}
/**
* Set whether the build process will fail if a validation error occurs.
*
* @param failOnError New value of property failOnError.
*/
public void setFailOnError(boolean failOnError)
{
this.failOnError = failOnError;
}
/**
* Helper method to fire an information message using the broadcaster
*
* @param message to be fired
*/
protected void info(String message)
{
getBroadcaster().fireInformationEvent(new ValidationEvent(this,
getWarFileName(), message));
}
/**
* Helper method to fire an error message using the broadcaster
*
* @param message to be fired
*/
protected void error(String message)
{
getBroadcaster().fireErrorEvent(new ValidationEvent(this,
getWarFileName(), message));
}
/**
* Helper method to fire a warning message using the broadcaster
*
* @param message to be fired
*/
protected void warning(String message)
{
getBroadcaster().fireWarningEvent(new ValidationEvent(this,
getWarFileName(), message));
}
}

View File

@@ -1,81 +0,0 @@
package org.apache.maven.j2ee.war;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
/**
* A class to represent the <code>&lt;form-login-config&gt;</code> element of
* a war file
*
* @author dion
* @version $Id$
*/
public class FormLoginConfig
{
/** login page in the web app */
private String loginPage;
/** error page in the web app to be displayed when login fails*/
private String errorPage;
/** Create an instance of the class with null values for all fields */
public FormLoginConfig()
{
}
/** Create an instance of the class with the given values for fields
* @param login initial value of loginPage property
* @param error initial value if errorPage property
*/
public FormLoginConfig(String login, String error)
{
setLoginPage(login);
setErrorPage(error);
}
/** Getter for property errorPage.
* @return Value of property errorPage.
*/
public String getErrorPage()
{
return errorPage;
}
/** Setter for property errorPage.
* @param errorPage New value of property errorPage.
*/
public void setErrorPage(String errorPage)
{
this.errorPage = errorPage;
}
/** Getter for property loginPage.
* @return Value of property loginPage.
*/
public String getLoginPage()
{
return loginPage;
}
/** Setter for property loginPage.
* @param loginPage New value of property loginPage.
*/
public void setLoginPage(String loginPage)
{
this.loginPage = loginPage;
}
}

View File

@@ -1,506 +0,0 @@
<!--
Copyright (c) 2000 Sun Microsystems, Inc.,
901 San Antonio Road,
Palo Alto, California 94303, U.S.A.
All rights reserved.
Sun Microsystems, Inc. has intellectual property rights relating to
technology embodied in the product that is described in this document.
In particular, and without limitation, these intellectual property
rights may include one or more of the U.S. patents listed at
http://www.sun.com/patents and one or more additional patents or
pending patent applications in the U.S. and in other countries.
This document and the product to which it pertains are distributed
under licenses restricting their use, copying, distribution, and
decompilation. This document may be reproduced and distributed but may
not be changed without prior written authorization of Sun and its
licensors, if any.
Third-party software, including font technology, is copyrighted and
licensed from Sun suppliers.
Sun, Sun Microsystems, the Sun logo, Java, JavaServer Pages, Java
Naming and Directory Interface, JDBC, JDK, JavaMail and and
Enterprise JavaBeans are trademarks or registered trademarks of Sun
Microsystems, Inc. in the U.S. and other countries.
Federal Acquisitions: Commercial Software - Government Users Subject to
Standard License Terms and Conditions.
DOCUMENTATION IS PROVIDED "AS IS" AND ALL EXPRESS OR IMPLIED
CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED
WARRANTY OF MERCHANTABILITY, FITNESS FOR FOR A PARTICULAR PURPOSE OR
NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH
DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.
_________________________________________________________________________
Copyright (c) 2000 Sun Microsystems, Inc.,
901 San Antonio Road,
Palo Alto, California 94303, E'tats-Unis.
Tous droits re'serve's.
Sun Microsystems, Inc. a les droits de proprie'te' intellectuels
relatants a` la technologie incorpore'e dans le produit qui est de'crit
dans ce document. En particulier, et sans la limitation, ces droits de
proprie'te' intellectuels peuvent inclure un ou plus des brevets
ame'ricains e'nume're's a` http://www.sun.com/patents et un ou les
brevets plus supple'mentaires ou les applications de brevet en attente
dans les E'tats-Unis et dans les autres pays.
Ce produit ou document est prote'ge' par un copyright et distribue'
avec des licences qui en restreignent l'utilisation, la copie, la
distribution, et la de'compilation. Ce documention associe n peut
e^tre reproduite et distribuer, par quelque moyen que ce soit, sans
l'autorisation pre'alable et e'crite de Sun et de ses bailleurs de
licence, le cas e'che'ant.
Le logiciel de'tenu par des tiers, et qui comprend la technologie
relative aux polices de caracte`res, est prote'ge' par un copyright et
licencie' par des fournisseurs de Sun.
Sun, Sun Microsystems, le logo Sun, Java, JavaServer Pages, Java
Naming and Directory Interface, JDBC, JDK, JavaMail et and
Enterprise JavaBeans sont des marques de fabrique ou des marques
de'pose'es de Sun Microsystems, Inc. aux E'tats-Unis et dans d'autres
pays.
LA DOCUMENTATION EST FOURNIE "EN L'E'TAT" ET TOUTES AUTRES CONDITIONS,
DECLARATIONS ET GARANTIES EXPRESSES OU TACITES SONT FORMELLEMENT
EXCLUES, DANS LA MESURE AUTORISEE PAR LA LOI APPLICABLE, Y COMPRIS
NOTAMMENT TOUTE GARANTIE IMPLICITE RELATIVE A LA QUALITE MARCHANDE, A
L'APTITUDE A UNE UTILISATION PARTICULIERE OU A L'ABSENCE DE
CONTREFAC,ON.
-->
<!--
This is the XML DTD for the J2EE 1.3 application client deployment
descriptor. All J2EE 1.3 application client deployment descriptors
must include a DOCTYPE of the following form:
<!DOCTYPE application-client PUBLIC
"-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.3//EN"
"http://java.sun.com/dtd/application-client_1_3.dtd">
-->
<!--
The following conventions apply to all J2EE deployment descriptor
elements unless indicated otherwise.
- In elements that contain PCDATA, leading and trailing whitespace
in the data may be ignored.
- In elements whose value is an "enumerated type", the value is
case sensitive.
- In elements that specify a pathname to a file within the same
JAR file, relative filenames (i.e., those not starting with "/")
are considered relative to the root of the JAR file's namespace.
Absolute filenames (i.e., those starting with "/") also specify
names in the root of the JAR file's namespace. In general, relative
names are preferred. The exception is .war files where absolute
names are preferred for consistency with the servlet API.
-->
<!--
The application-client element is the root element of an application
client deployment descriptor. The application client deployment
descriptor describes the EJB components and external resources
referenced by the application client.
-->
<!ELEMENT application-client (icon?, display-name, description?,
env-entry*, ejb-ref*, resource-ref*, resource-env-ref*,
callback-handler?)>
<!--
The callback-handler element names a class provided by the
application. The class must have a no args constructor and must
implement the javax.security.auth.callback.CallbackHandler interface.
The class will be instantiated by the application client container and
used by the container to collect authentication information from the
user.
Used in: application-client
-->
<!ELEMENT callback-handler (#PCDATA)>
<!--
The description element is used to provide text describing the parent
element. The description element should include any information that
the application client jar file producer wants to provide to the consumer of
the application client jar file (i.e., to the Deployer). Typically, the tools
used by the application client jar file consumer will display the description
when processing the parent element that contains the description.
Used in: application-client, ejb-ref, env-entry, resource-env-ref,
resource-ref
-->
<!ELEMENT description (#PCDATA)>
<!--
The display-name element contains a short name that is intended to be
displayed by tools. The display name need not be unique.
Used in: application-client
Example:
<display-name>Employee Self Service</display-name>
-->
<!ELEMENT display-name (#PCDATA)>
<!--
The ejb-link element is used in the ejb-ref element
to specify that an EJB reference is linked to an
enterprise bean.
The name in the ejb-link element is composed of a
path name specifying the ejb-jar containing the referenced enterprise
bean with the ejb-name of the target bean appended and separated from
the path name by "#". The path name is relative to the jar file
containing the application client that is referencing the enterprise bean.
This allows multiple enterprise beans with the same ejb-name to be
uniquely identified.
Used in: ejb-ref
Examples:
<ejb-link>EmployeeRecord</ejb-link>
<ejb-link>../products/product.jar#ProductEJB</ejb-link>
-->
<!ELEMENT ejb-link (#PCDATA)>
<!--
The ejb-ref element is used for the declaration of a reference to
an enterprise bean's home. The declaration consists of:
- an optional description
- the EJB reference name used in the code of
the application client that's referencing the enterprise bean
- the expected type of the referenced enterprise bean
- the expected home and remote interfaces of the referenced
enterprise bean
- optional ejb-link information, used to specify the referenced
enterprise bean
Used in: application-client
-->
<!ELEMENT ejb-ref (description?, ejb-ref-name, ejb-ref-type,
home, remote, ejb-link?)>
<!--
The ejb-ref-name element contains the name of an EJB reference. The
EJB reference is an entry in the application client's environment and is
relative to the java:comp/env context. The name must be unique
within the application client.
It is recommended that name is prefixed with "ejb/".
Used in: ejb-ref
Example:
<ejb-ref-name>ejb/Payroll</ejb-ref-name>
-->
<!ELEMENT ejb-ref-name (#PCDATA)>
<!--
The ejb-ref-type element contains the expected type of the
referenced enterprise bean.
The ejb-ref-type element must be one of the following:
<ejb-ref-type>Entity</ejb-ref-type>
<ejb-ref-type>Session</ejb-ref-type>
Used in: ejb-ref
-->
<!ELEMENT ejb-ref-type (#PCDATA)>
<!--
The env-entry element contains the declaration of an application client's
environment entry. The declaration consists of an optional
description, the name of the environment entry, and an optional
value. If a value is not specified, one must be supplied
during deployment.
Used in: application-client
-->
<!ELEMENT env-entry (description?, env-entry-name, env-entry-type,
env-entry-value?)>
<!--
The env-entry-name element contains the name of an application client's
environment entry. The name is a JNDI name relative to the
java:comp/env context. The name must be unique within an application client.
Used in: env-entry
Example:
<env-entry-name>minAmount</env-entry-name>
-->
<!ELEMENT env-entry-name (#PCDATA)>
<!--
The env-entry-type element contains the fully-qualified Java type of
the environment entry value that is expected by the application client's
code.
The following are the legal values of env-entry-type:
java.lang.Boolean
java.lang.Byte
java.lang.Character
java.lang.String
java.lang.Short
java.lang.Integer
java.lang.Long
java.lang.Float
java.lang.Double
Used in: env-entry
Example:
<env-entry-type>java.lang.Boolean</env-entry-type>
-->
<!ELEMENT env-entry-type (#PCDATA)>
<!--
The env-entry-value element contains the value of an application client's
environment entry. The value must be a String that is valid for the
constructor of the specified type that takes a single String
parameter, or for java.lang.Character, a single character.
Used in: env-entry
Example:
<env-entry-value>100.00</env-entry-value>
-->
<!ELEMENT env-entry-value (#PCDATA)>
<!--
The home element contains the fully-qualified name of the enterprise
bean's home interface.
Used in: ejb-ref
Example:
<home>com.aardvark.payroll.PayrollHome</home>
-->
<!ELEMENT home (#PCDATA)>
<!--
The icon element contains small-icon and large-icon elements that
specify the file names for small and a large GIF or JPEG icon images
used to represent the parent element in a GUI tool.
Used in: application-client
-->
<!ELEMENT icon (small-icon?, large-icon?)>
<!--
The large-icon element contains the name of a file
containing a large (32 x 32) icon image. The file
name is a relative path within the application client's
jar file.
The image may be either in the JPEG or GIF format.
The icon can be used by tools.
Used in: icon
Example:
<large-icon>employee-service-icon32x32.jpg</large-icon>
-->
<!ELEMENT large-icon (#PCDATA)>
<!--
The remote element contains the fully-qualified name of the enterprise
bean's remote interface.
Used in: ejb-ref
Example:
<remote>com.wombat.empl.EmployeeService</remote>
-->
<!ELEMENT remote (#PCDATA)>
<!--
The res-auth element specifies whether the application client code signs
on programmatically to the resource manager, or whether the Container
will sign on to the resource manager on behalf of the application client. In the
latter case, the Container uses information that is supplied by the
Deployer.
The value of this element must be one of the two following:
<res-auth>Application</res-auth>
<res-auth>Container</res-auth>
Used in: resource-ref
-->
<!ELEMENT res-auth (#PCDATA)>
<!--
The res-ref-name element specifies the name of a resource manager
connection factory reference. The name is a JNDI name relative to the
java:comp/env context. The name must be unique within an application client.
Used in: resource-ref
-->
<!ELEMENT res-ref-name (#PCDATA)>
<!--
The res-sharing-scope element specifies whether connections obtained
through the given resource manager connection factory reference can be
shared. The value of this element, if specified, must be one of the
two following:
<res-sharing-scope>Shareable</res-sharing-scope>
<res-sharing-scope>Unshareable</res-sharing-scope>
The default value is Shareable.
Used in: resource-ref
-->
<!ELEMENT res-sharing-scope (#PCDATA)>
<!--
The res-type element specifies the type of the data source. The type
is specified by the fully qualified Java language class or interface
expected to be implemented by the data source.
Used in: resource-ref
-->
<!ELEMENT res-type (#PCDATA)>
<!--
The resource-env-ref element contains a declaration of an application client's
reference to an administered object associated with a resource
in the application client's environment. It consists of an optional
description, the resource environment reference name, and an
indication of the resource environment reference type expected by
the application client code.
Used in: application-client
Example:
<resource-env-ref>
<resource-env-ref-name>jms/StockQueue</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>
-->
<!ELEMENT resource-env-ref (description?, resource-env-ref-name,
resource-env-ref-type)>
<!--
The resource-env-ref-name element specifies the name of a resource
environment reference; its value is the environment entry name used in
the application client code. The name is a JNDI name relative to the
java:comp/env context and must be unique within an application client.
Used in: resource-env-ref
-->
<!ELEMENT resource-env-ref-name (#PCDATA)>
<!--
The resource-env-ref-type element specifies the type of a resource
environment reference. It is the fully qualified name of a Java
language class or interface.
Used in: resource-env-ref
-->
<!ELEMENT resource-env-ref-type (#PCDATA)>
<!--
The resource-ref element contains a declaration of an application client's
reference to an external resource. It consists of an optional
description, the resource manager connection factory reference name,
the indication of the resource manager connection factory type
expected by the application client code, the type of authentication
(Application or Container), and an optional specification of the
shareability of connections obtained from the resource (Shareable or
Unshareable).
Used in: application-client
Example:
<resource-ref>
<res-ref-name>jdbc/EmployeeAppDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
-->
<!ELEMENT resource-ref (description?, res-ref-name, res-type, res-auth,
res-sharing-scope?)>
<!--
The small-icon element contains the name of a file
containing a small (16 x 16) icon image. The file
name is a relative path within the application client's
jar file.
The image may be either in the JPEG or GIF format.
The icon can be used by tools.
Used in: icon
Example:
<small-icon>employee-service-icon16x16.jpg</small-icon>
-->
<!ELEMENT small-icon (#PCDATA)>
<!--
The ID mechanism is to allow tools that produce additional deployment
information (i.e., information beyond the standard deployment
descriptor information) to store the non-standard information in a
separate file, and easily refer from these tool-specific files to the
information in the standard deployment descriptor.
Tools are not allowed to add the non-standard information into the
standard deployment descriptor.
-->
<!ATTLIST application-client id ID #IMPLIED>
<!ATTLIST callback-handler id ID #IMPLIED>
<!ATTLIST description id ID #IMPLIED>
<!ATTLIST display-name id ID #IMPLIED>
<!ATTLIST ejb-link id ID #IMPLIED>
<!ATTLIST ejb-ref id ID #IMPLIED>
<!ATTLIST ejb-ref-name id ID #IMPLIED>
<!ATTLIST ejb-ref-type id ID #IMPLIED>
<!ATTLIST env-entry id ID #IMPLIED>
<!ATTLIST env-entry-name id ID #IMPLIED>
<!ATTLIST env-entry-type id ID #IMPLIED>
<!ATTLIST env-entry-value id ID #IMPLIED>
<!ATTLIST home id ID #IMPLIED>
<!ATTLIST icon id ID #IMPLIED>
<!ATTLIST large-icon id ID #IMPLIED>
<!ATTLIST remote id ID #IMPLIED>
<!ATTLIST res-auth id ID #IMPLIED>
<!ATTLIST res-ref-name id ID #IMPLIED>
<!ATTLIST res-sharing-scope id ID #IMPLIED>
<!ATTLIST res-type id ID #IMPLIED>
<!ATTLIST resource-env-ref id ID #IMPLIED>
<!ATTLIST resource-env-ref-name id ID #IMPLIED>
<!ATTLIST resource-env-ref-type id ID #IMPLIED>
<!ATTLIST resource-ref id ID #IMPLIED>
<!ATTLIST small-icon id ID #IMPLIED>

Some files were not shown because too many files have changed in this diff Show More