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);
	}
  
}
