felipeal    2004/11/06 13:51:31

  Added:       hibernate/src/main/org/apache/maven/hibernate/jelly
                        SchemaUpdateTag.java
               hibernate/src/main/org/apache/maven/hibernate/beans
                        SchemaUpdateBean.java
  Log:
  MPHIBERNATE-13: new class necessary to implement hibernate:schema-update
  
  Revision  Changes    Path
  1.1                  
maven-plugins/hibernate/src/main/org/apache/maven/hibernate/jelly/SchemaUpdateTag.java
  
  Index: SchemaUpdateTag.java
  ===================================================================
  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 [EMAIL PROTECTED] SchemaUpdateBean}
   * 
   * @author <a href="[EMAIL PROTECTED]">Felipe Leme</a> 
   * @version $Id: SchemaUpdateTag.java,v 1.1 2004/11/06 21:51:31 felipeal Exp $
   */
  public class SchemaUpdateTag extends SchemaTagBase
  {
       
     public SchemaUpdateTag() {
       super( new SchemaUpdateBean() );
     }
     
  }
  
  
  
  1.1                  
maven-plugins/hibernate/src/main/org/apache/maven/hibernate/beans/SchemaUpdateBean.java
  
  Index: SchemaUpdateBean.java
  ===================================================================
  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="[EMAIL PROTECTED]">Felipe Leme</a> 
   * @version $Id: SchemaUpdateBean.java,v 1.1 2004/11/06 21:51:31 felipeal Exp $
   */
  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() );
      }
     
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to