Initial import to CVS
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113422 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e66dc52695
commit
e81ddc8283
3
hibernate/.cvsignore
Normal file
3
hibernate/.cvsignore
Normal file
@ -0,0 +1,3 @@
|
||||
target
|
||||
velocity.log
|
||||
maven.log
|
||||
35
hibernate/plugin.jelly
Normal file
35
hibernate/plugin.jelly
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:ant="jelly:ant"
|
||||
xmlns:h="jelly:org.apache.maven.hibernate.jelly.HibernateTagLibrary">>
|
||||
|
||||
<goal name="hibernate:init">
|
||||
|
||||
</goal>
|
||||
|
||||
|
||||
|
||||
<goal name="hibernate:schema-export" prereqs="hibernate:init">
|
||||
|
||||
<ant:echo>Exporting Hibernate Schema file</ant:echo>
|
||||
<ant:mkdir dir="${maven.hibernate.output.dir}"/>
|
||||
|
||||
<h:schema-export
|
||||
properties="${maven.hibernate.properties}"
|
||||
quiet="${maven.hibernate.quiet}"
|
||||
text="${maven.hibernate.text}"
|
||||
drop="${maven.hibernate.drop}"
|
||||
outputFile="${maven.hibernate.output.file}"
|
||||
basedir="${maven.hibernate.input.dir}"
|
||||
includes="${maven.hibernate.input.includes}"
|
||||
excludes="${maven.hibernate.input.excludes}"/>
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
9
hibernate/plugin.properties
Normal file
9
hibernate/plugin.properties
Normal file
@ -0,0 +1,9 @@
|
||||
#maven.hibernate.properties=
|
||||
maven.hibernate.quiet=yes
|
||||
maven.hibernate.text=no
|
||||
maven.hibernate.drop=no
|
||||
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=
|
||||
8
hibernate/project.properties
Normal file
8
hibernate/project.properties
Normal file
@ -0,0 +1,8 @@
|
||||
# -------------------------------------------------------------------
|
||||
# P R O J E C T P R O P E R T I E S
|
||||
# -------------------------------------------------------------------
|
||||
maven.xdoc.date=left
|
||||
maven.xdoc.version=${pom.currentVersion}
|
||||
maven.license.licenseFile=${basedir}/../../../LICENSE.txt
|
||||
maven.docs.outputencoding=UTF-8
|
||||
|
||||
140
hibernate/project.xml
Normal file
140
hibernate/project.xml
Normal file
@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project>
|
||||
<extend>${basedir}/../project.xml</extend>
|
||||
<pomVersion>3</pomVersion>
|
||||
<id>maven-hibernate-plugin</id>
|
||||
<name>Maven Hibernate Plug-in</name>
|
||||
<currentVersion>1.0-SNAPHOT</currentVersion>
|
||||
<description/>
|
||||
<shortDescription>Java Project Management Tools</shortDescription>
|
||||
<url>http://maven.apache.org/reference/plugins/hibernate/</url>
|
||||
<siteDirectory>/www/maven.apache.org/reference/plugins/hibernate/</siteDirectory>
|
||||
<repository>
|
||||
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven/src/plugins-build/hibernate/</connection>
|
||||
<url>http://cvs.apache.org/viewcvs/maven/src/plugins-build/hibernate/</url>
|
||||
</repository>
|
||||
<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>
|
||||
</developers>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>hibernate</groupId>
|
||||
<artifactId>hibernate</artifactId>
|
||||
<version>2.0-beta-6</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
<version>1.5.1</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>commons-jelly</id>
|
||||
<version>20030211.141339</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>1.6</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-dbcp</groupId>
|
||||
<artifactId>commons-dbcp</artifactId>
|
||||
<version>1.0-dev</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>2.1</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-pool</groupId>
|
||||
<artifactId>commons-pool</artifactId>
|
||||
<version>1.0</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.8</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xmlParserAPIs</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<url>http://xml.apache.org/xerces2-j/</url>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xerces</artifactId>
|
||||
<version>2.3.0</version>
|
||||
<url>http://xml.apache.org/xerces2-j/</url>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>odmg</groupId>
|
||||
<artifactId>odmg</artifactId>
|
||||
<version>3.0</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
<version>1.3</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib</artifactId>
|
||||
<version>1.0</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,365 @@
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2001 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache MavenSession" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache MavenSession", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
package org.apache.maven.hibernate.beans;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import net.sf.hibernate.HibernateException;
|
||||
import net.sf.hibernate.cfg.Configuration;
|
||||
import net.sf.hibernate.tool.hbm2ddl.SchemaExport;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.tools.ant.DirectoryScanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* The Bean which serves as Proxy To Hibernate API
|
||||
* <br/>
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
|
||||
* @version $Id: SchemaExportBean.java,v 1.1 2003/05/15 13:06:27 michal Exp $
|
||||
*/
|
||||
public class SchemaExportBean
|
||||
{
|
||||
|
||||
private String includes = null;
|
||||
private String excludes = null;
|
||||
private String basedir = null;
|
||||
private String properties = null;
|
||||
private String config = null;
|
||||
private String outputFile = null;
|
||||
private boolean quiet = false;
|
||||
private boolean text = false;
|
||||
private boolean drop = false;
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getIncludes()
|
||||
{
|
||||
return includes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getOutputFile()
|
||||
{
|
||||
return outputFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean getQuiet()
|
||||
{
|
||||
return quiet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean getText()
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public void setIncludes(String string)
|
||||
{
|
||||
includes = string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public void setOutputFile(String string)
|
||||
{
|
||||
outputFile = string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getBasedir()
|
||||
{
|
||||
return basedir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isDrop()
|
||||
{
|
||||
return drop;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getExcludes()
|
||||
{
|
||||
return excludes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public void setBasedir(String string)
|
||||
{
|
||||
basedir = string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setDrop(boolean b)
|
||||
{
|
||||
drop = b;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public void setExcludes(String string)
|
||||
{
|
||||
excludes = 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 baseDirFile = new File(getBasedir());
|
||||
URL[] urls = { baseDirFile.toURL()};
|
||||
System.out.println(urls[0]);
|
||||
URLClassLoader newClassLoader =
|
||||
new URLClassLoader(urls, oldClassLoader);
|
||||
currentThread.setContextClassLoader(newClassLoader);
|
||||
Configuration cfg = getConfiguration();
|
||||
SchemaExport schemaExport = getSchemaExport(cfg);
|
||||
|
||||
if (isDrop())
|
||||
{
|
||||
schemaExport.drop(!getQuiet(), !getText());
|
||||
}
|
||||
else
|
||||
{
|
||||
schemaExport.create(!getQuiet(), !getText());
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
currentThread.setContextClassLoader(oldClassLoader);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds list of files for which will be included
|
||||
* in the schema. Uses ANT file scanner.
|
||||
*/
|
||||
private String[] getFiles()
|
||||
{
|
||||
|
||||
List files = new LinkedList();
|
||||
|
||||
DirectoryScanner directoryScanner = new DirectoryScanner();
|
||||
directoryScanner.setBasedir(getBasedir());
|
||||
|
||||
System.out.println("Excludes:" + getExcludes());
|
||||
System.out.println("Includes:" + getIncludes());
|
||||
System.out.println("Base dir:" + getBasedir());
|
||||
|
||||
directoryScanner.setExcludes(StringUtils.split(getExcludes(), ","));
|
||||
directoryScanner.setIncludes(StringUtils.split(getIncludes(), ","));
|
||||
|
||||
directoryScanner.scan();
|
||||
String[] includesFiles = directoryScanner.getIncludedFiles();
|
||||
for (int i = 0; i < includesFiles.length; i++)
|
||||
{
|
||||
File file = new File(includesFiles[i]);
|
||||
if (!file.isFile())
|
||||
{
|
||||
file = new File(directoryScanner.getBasedir(), includesFiles[i]);
|
||||
}
|
||||
files.add(file.getAbsolutePath());
|
||||
}
|
||||
String[] retValue = (String[]) files.toArray(new String[0]);
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Configuration getConfiguration() throws HibernateException
|
||||
{
|
||||
Configuration cfg = new Configuration();
|
||||
if (getConfig() != null)
|
||||
{
|
||||
cfg.configure(getConfig());
|
||||
}
|
||||
|
||||
String[] files = getFiles();
|
||||
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 SchemaExport getSchemaExport(Configuration cfg)
|
||||
throws HibernateException, IOException
|
||||
{
|
||||
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);
|
||||
}
|
||||
System.out.println("Output file:" + getOutputFile());
|
||||
schemaExport.setOutputFile(getOutputFile());
|
||||
return schemaExport;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2001 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache MavenSession" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache MavenSession", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
package org.apache.maven.hibernate.jelly;
|
||||
|
||||
import org.apache.commons.jelly.tags.core.CoreTagLibrary;
|
||||
|
||||
|
||||
/**
|
||||
* Hibernate tag library.
|
||||
*
|
||||
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
|
||||
* @version $Id: HibernateTagLibrary.java,v 1.1 2003/05/15 13:06:26 michal Exp $
|
||||
*/
|
||||
public class HibernateTagLibrary extends CoreTagLibrary
|
||||
{
|
||||
/**
|
||||
* Create an instance of the {@link HibernateTagLibrary}, registering related
|
||||
* tag libraries
|
||||
*/
|
||||
public HibernateTagLibrary()
|
||||
{
|
||||
registerTag( "schema-export", SchemaExportTag.class );
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,253 @@
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2001 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache MavenSession" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache MavenSession", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
package org.apache.maven.hibernate.jelly;
|
||||
|
||||
import org.apache.commons.jelly.JellyTagException;
|
||||
import org.apache.commons.jelly.TagSupport;
|
||||
import org.apache.commons.jelly.XMLOutput;
|
||||
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: SchemaExportTag.java,v 1.1 2003/05/15 13:06:25 michal Exp $
|
||||
*/
|
||||
public class SchemaExportTag extends TagSupport
|
||||
{
|
||||
|
||||
private SchemaExportBean bean = new SchemaExportBean();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected void execute() throws JellyTagException
|
||||
{
|
||||
try
|
||||
{
|
||||
bean.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
String msg = " Schema Export 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 b
|
||||
*/
|
||||
public void setDrop(boolean b)
|
||||
{
|
||||
bean.setDrop(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public void setIncludes(String string)
|
||||
{
|
||||
bean.setIncludes(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getOutputFile()
|
||||
{
|
||||
return bean.getOutputFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getExcludes()
|
||||
{
|
||||
return bean.getExcludes();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public void setOutputFile(String string)
|
||||
{
|
||||
bean.setOutputFile(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isDrop()
|
||||
{
|
||||
return bean.isDrop();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
|
||||
}
|
||||
1
hibernate/xdocs/.cvsignore
Normal file
1
hibernate/xdocs/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
stylesheets
|
||||
16
hibernate/xdocs/changes.xml
Normal file
16
hibernate/xdocs/changes.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
<properties>
|
||||
<title>Changes</title>
|
||||
<author email="michal.maczka@dimatics.com">Michal Maczka</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<release version="1.0" date="in CVS">
|
||||
<action dev="michal" type="add">
|
||||
Initial plugin created
|
||||
</action>
|
||||
</release>
|
||||
</body>
|
||||
</document>
|
||||
|
||||
24
hibernate/xdocs/goals.xml
Normal file
24
hibernate/xdocs/goals.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<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>
|
||||
|
||||
<a name="hibernate:schma-export" />
|
||||
<tr>
|
||||
<td>hibernate:schma-export</td>
|
||||
<td>
|
||||
Creates SQL DDL file from set of *.hbm.xml files
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
19
hibernate/xdocs/index.xml
Normal file
19
hibernate/xdocs/index.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
<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 intergration with
|
||||
<a href="http://db.apache.org/torque/">Hiberante 2.x</a> for your project.
|
||||
<br/>
|
||||
For the moment the functionality is very limited.
|
||||
</p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
16
hibernate/xdocs/navigation.xml
Normal file
16
hibernate/xdocs/navigation.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project name="Maven Hibernate Plugin">
|
||||
|
||||
<title>Maven Hibernate Plugin</title>
|
||||
|
||||
<body>
|
||||
<links>
|
||||
<item name="Maven" href="http://maven.apache.org/"/>
|
||||
<item name="Hibernate" href="http://hibernate.sourceforge.net"/>
|
||||
</links>
|
||||
<menu name="Overview">
|
||||
<item name="Goals" href="/goals.html" />
|
||||
<item name="Properties" href="/properties.html" />
|
||||
</menu>
|
||||
</body>
|
||||
</project>
|
||||
109
hibernate/xdocs/properties.xml
Normal file
109
hibernate/xdocs/properties.xml
Normal file
@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<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 se in the
|
||||
runtime by Hibernate for confiuraing Hibernate Session,
|
||||
so it's better to keep it separatly from project's
|
||||
configuration files like
|
||||
<code>project.properties</code> etc.
|
||||
<br/>
|
||||
For description of the properties take a look
|
||||
at <a href="http://hibernate.bluemars.net/hib_docs/reference/html/session-configuration.html">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>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.hibernate.drop</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Indicates...
|
||||
<br/>
|
||||
It defaults to <code>no</code>
|
||||
</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>
|
||||
Used to generate the <code>url</code> value for Gump
|
||||
Indicates base directory where mapping files. 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 Hiberante 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 Hiberante 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>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
Loading…
x
Reference in New Issue
Block a user