You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2004/05/05 18:38:25 UTC

cvs commit: db-ojb/src/tools/org/apache/ojb/tools/mapping/reversedb/gui/actions DBConnPropertiesAction.java DisableClassesWithRegexAction.java GenerateJavaClassesAction.java SaveXMLAction.java SetPackageAction.java

arminw      2004/05/05 09:38:25

  Added:       src/tools/org/apache/ojb/tools/mapping/reversedb/gui/actions
                        DBConnPropertiesAction.java
                        DisableClassesWithRegexAction.java
                        GenerateJavaClassesAction.java SaveXMLAction.java
                        SetPackageAction.java
  Log:
  fix fault
  wrong package structure used:
  org.apache.ojb.tools.reversdb
  org.apache.ojb.tools.reversdb2
  
  instead of
  org.apache.ojb.tools.mapping.reversdb
  org.apache.ojb.tools.mapping.reversdb2
  
  Revision  Changes    Path
  1.1                  db-ojb/src/tools/org/apache/ojb/tools/mapping/reversedb/gui/actions/DBConnPropertiesAction.java
  
  Index: DBConnPropertiesAction.java
  ===================================================================
  package org.apache.ojb.tools.mapping.reversedb.gui.actions;
  
  /* Copyright 2002-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.
   */
   
  /**
   *
   * @author Florian Bruckner
   * @version $Revision: 1.1 $
   */
  public class DBConnPropertiesAction extends javax.swing.AbstractAction
  {
      org.apache.ojb.tools.mapping.reversedb.gui.JFrmMainFrame mainFrame;
    /** Creates a new instance of DBConnPropertiesAction */
      public DBConnPropertiesAction(org.apache.ojb.tools.mapping.reversedb.gui.JFrmMainFrame pmainFrame)
    {
      super();
      this.mainFrame = pmainFrame;
      this.putValue(NAME, "Connect to Database");
    }
    
    public void actionPerformed (java.awt.event.ActionEvent actionEvent)
    {
      new org.apache.ojb.tools.mapping.reversedb.gui.JDlgDBConnection(mainFrame, true, mainFrame).show();
    }
  }
  
  /***************************** Changelog *****************************
  // $Log: DBConnPropertiesAction.java,v $
  // Revision 1.1  2004/05/05 16:38:25  arminw
  // fix fault
  // wrong package structure used:
  // org.apache.ojb.tools.reversdb
  // org.apache.ojb.tools.reversdb2
  //
  // instead of
  // org.apache.ojb.tools.mapping.reversdb
  // org.apache.ojb.tools.mapping.reversdb2
  //
  // Revision 1.1  2004/05/04 13:44:59  arminw
  // move reverseDB stuff
  //
  // Revision 1.6  2004/04/05 12:16:24  tomdz
  // Fixed/updated license in files leftover from automatic license transition
  //
  // Revision 1.5  2004/04/04 23:53:42  brianm
  // Fixed initial copyright dates to match cvs repository
  //
  // Revision 1.4  2004/03/11 18:16:23  brianm
  // ASL 2.0
  //
  // Revision 1.3  2002/11/08 13:47:38  brj
  // corrected some compiler warnings
  //
  // Revision 1.2  2002/06/17 19:34:34  jvanzyl
  // Correcting all the package references.
  // PR:
  // Obtained from:
  // Submitted by:
  // Reviewed by:
  //
  // Revision 1.1.1.1  2002/06/17 18:16:54  jvanzyl
  // Initial OJB import
  //
  // Revision 1.2  2002/05/16 11:47:09  florianbruckner
  // fix CR/LF issue, change license to ASL
  //
  // Revision 1.1  2002/04/18 11:44:16  mpoeschl
  //
  // move files to new location
  //
  // Revision 1.2  2002/04/07 09:05:17  thma
  // *** empty log message ***
  //
  // Revision 1.1.1.1  2002/02/20 13:35:25  Administrator
  // initial import
  //
  /***************************** Changelog *****************************/
   
  
  
  
  1.1                  db-ojb/src/tools/org/apache/ojb/tools/mapping/reversedb/gui/actions/DisableClassesWithRegexAction.java
  
  Index: DisableClassesWithRegexAction.java
  ===================================================================
  package org.apache.ojb.tools.mapping.reversedb.gui.actions;
  
  /* Copyright 2002-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.
   */
  
  /**
   *
   * @author <a href="mailto:bfl@florianbruckner.com">Florian Bruckner</a> 
   * @version $Id: DisableClassesWithRegexAction.java,v 1.1 2004/05/05 16:38:25 arminw Exp $
   */
  public class DisableClassesWithRegexAction extends javax.swing.AbstractAction
  {
    org.apache.ojb.tools.mapping.reversedb.gui.JFrmMainFrame mainFrame;
    
    /** Creates a new instance of SetPackageAction */
    public DisableClassesWithRegexAction (org.apache.ojb.tools.mapping.reversedb.gui.JFrmMainFrame pmainFrame)
    {
      super();
      mainFrame = pmainFrame;
      this.putValue(NAME, "Disable Classes");
    }
    
    public void actionPerformed (java.awt.event.ActionEvent actionEvent)
    {
      String strRegex = javax.swing.JOptionPane.showInputDialog(
        mainFrame, "Enter a regular expression", 
        "Disable Classes", javax.swing.JOptionPane.QUESTION_MESSAGE);
      try
      {
        if (strRegex != null)
          mainFrame.getDBMeta().disableClassesWithRegex(new org.apache.regexp.RE(strRegex));
      }
      catch (org.apache.regexp.RESyntaxException ree)
      {
        ree.printStackTrace();
      }
    }
  }
  
  /***************************** Changelog *****************************
  // $Log: DisableClassesWithRegexAction.java,v $
  // Revision 1.1  2004/05/05 16:38:25  arminw
  // fix fault
  // wrong package structure used:
  // org.apache.ojb.tools.reversdb
  // org.apache.ojb.tools.reversdb2
  //
  // instead of
  // org.apache.ojb.tools.mapping.reversdb
  // org.apache.ojb.tools.mapping.reversdb2
  //
  // Revision 1.1  2004/05/04 13:44:59  arminw
  // move reverseDB stuff
  //
  // Revision 1.6  2004/04/05 12:16:24  tomdz
  // Fixed/updated license in files leftover from automatic license transition
  //
  // Revision 1.5  2004/04/04 23:53:42  brianm
  // Fixed initial copyright dates to match cvs repository
  //
  // Revision 1.4  2004/03/11 18:16:23  brianm
  // ASL 2.0
  //
  // Revision 1.3  2002/11/08 13:47:38  brj
  // corrected some compiler warnings
  //
  // Revision 1.2  2002/06/17 19:34:34  jvanzyl
  // Correcting all the package references.
  // PR:
  // Obtained from:
  // Submitted by:
  // Reviewed by:
  //
  // Revision 1.1.1.1  2002/06/17 18:16:54  jvanzyl
  // Initial OJB import
  //
  // Revision 1.3  2002/05/16 11:47:09  florianbruckner
  // fix CR/LF issue, change license to ASL
  //
  // Revision 1.2  2002/05/16 10:43:59  florianbruckner
  // use jakarta-regexp instead of gnu-regexp due to the move to jakarta.
  //
  // Revision 1.1  2002/04/18 11:44:16  mpoeschl
  //
  // move files to new location
  //
  // Revision 1.2  2002/04/07 09:05:17  thma
  // *** empty log message ***
  //
  // Revision 1.1.1.1  2002/02/20 13:35:25  Administrator
  // initial import
  //
  /***************************** Changelog *****************************/
   
  
  
  
  1.1                  db-ojb/src/tools/org/apache/ojb/tools/mapping/reversedb/gui/actions/GenerateJavaClassesAction.java
  
  Index: GenerateJavaClassesAction.java
  ===================================================================
  package org.apache.ojb.tools.mapping.reversedb.gui.actions;
  
  /* Copyright 2002-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.JOptionPane; 
  /**
   *
   * @author Florian Bruckner
   * @version $Revision: 1.1 $
   */
  public class GenerateJavaClassesAction extends javax.swing.AbstractAction
  {
    org.apache.ojb.tools.mapping.reversedb.gui.JFrmMainFrame mainFrame;  
    /** Creates a new instance of GenerateJavaClassesAction */
    public GenerateJavaClassesAction (org.apache.ojb.tools.mapping.reversedb.gui.JFrmMainFrame pmainFrame)
    {
      super();
      mainFrame = pmainFrame;
      this.putValue(NAME, "Generate Java");    
    }
    
    public void actionPerformed (java.awt.event.ActionEvent actionEvent)
    {
      // 1. Open a Filechooser dialog to get the directory for the java Files
      javax.swing.JFileChooser fileChooser = new javax.swing.JFileChooser();
      fileChooser.setDialogTitle("Select Directory for Java generation");
      fileChooser.setFileSelectionMode(javax.swing.JFileChooser.DIRECTORIES_ONLY);
      int rc = fileChooser.showSaveDialog(mainFrame);
      if (rc == javax.swing.JFileChooser.APPROVE_OPTION)
      {
        java.io.File f = fileChooser.getSelectedFile();
        try
        {
          if (!f.isDirectory())
          {
              JOptionPane.showMessageDialog(mainFrame, "Selected item is not a directory", "Generate Java", JOptionPane.ERROR_MESSAGE);
              return;
          }
          if (f.canWrite())
          {
            mainFrame.getDBMeta().generateJava(f, "", "");
          }
          else
          {
              JOptionPane.showMessageDialog(mainFrame, "Cannot write to selected directory", "Generate Java", JOptionPane.ERROR_MESSAGE);
              return;
          }
        }        
        catch (java.io.FileNotFoundException fnfe)
        {
            fnfe.printStackTrace();
            JOptionPane.showMessageDialog(mainFrame, "File not found:\n" + fnfe.getMessage(), "Generate Java", JOptionPane.ERROR_MESSAGE);
        }
        catch (java.io.IOException ioex)
        {
            ioex.printStackTrace();          
            JOptionPane.showMessageDialog(mainFrame, "I/O Error:\n" + ioex.getMessage(), "Generate Java", JOptionPane.ERROR_MESSAGE);
        }
        catch (Throwable t)
        {
            t.printStackTrace();
            JOptionPane.showMessageDialog(mainFrame, "Error:\n" + t.getMessage(), "Generate Java", JOptionPane.ERROR_MESSAGE);
        }
      }    
    }
    
  }
  
  /***************************** Changelog *****************************
  // $Log: GenerateJavaClassesAction.java,v $
  // Revision 1.1  2004/05/05 16:38:25  arminw
  // fix fault
  // wrong package structure used:
  // org.apache.ojb.tools.reversdb
  // org.apache.ojb.tools.reversdb2
  //
  // instead of
  // org.apache.ojb.tools.mapping.reversdb
  // org.apache.ojb.tools.mapping.reversdb2
  //
  // Revision 1.1  2004/05/04 13:44:59  arminw
  // move reverseDB stuff
  //
  // Revision 1.6  2004/04/04 23:53:42  brianm
  // Fixed initial copyright dates to match cvs repository
  //
  // Revision 1.5  2004/03/11 18:16:23  brianm
  // ASL 2.0
  //
  // Revision 1.4  2003/06/21 10:39:13  florianbruckner
  // improve error reporting; use writeXML(PrintWriter) instead of getXML()
  //
  // Revision 1.3  2002/11/08 13:47:38  brj
  // corrected some compiler warnings
  //
  // Revision 1.2  2002/06/17 19:34:34  jvanzyl
  // Correcting all the package references.
  // PR:
  // Obtained from:
  // Submitted by:
  // Reviewed by:
  //
  // Revision 1.1.1.1  2002/06/17 18:16:54  jvanzyl
  // Initial OJB import
  //
  // Revision 1.2  2002/05/16 11:47:09  florianbruckner
  // fix CR/LF issue, change license to ASL
  //
  // Revision 1.1  2002/04/18 11:44:16  mpoeschl
  //
  // move files to new location
  //
  // Revision 1.2  2002/04/07 09:05:17  thma
  // *** empty log message ***
  //
  // Revision 1.1.1.1  2002/02/20 13:35:25  Administrator
  // initial import
  //
  /***************************** Changelog *****************************/
   
  
  
  
  1.1                  db-ojb/src/tools/org/apache/ojb/tools/mapping/reversedb/gui/actions/SaveXMLAction.java
  
  Index: SaveXMLAction.java
  ===================================================================
  package org.apache.ojb.tools.mapping.reversedb.gui.actions;
  
  /* Copyright 2002-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.
   */
   
  /**
   *
   * @author <a href="mailto:bfl@florianbruckner.com">Florian Bruckner</a> 
   * @version $Id: SaveXMLAction.java,v 1.1 2004/05/05 16:38:25 arminw Exp $
   */
  public class SaveXMLAction extends javax.swing.AbstractAction
  {
    org.apache.ojb.tools.mapping.reversedb.gui.JFrmMainFrame mainFrame;
    
    /** Creates a new instance of SaveXMLAction */
    public SaveXMLAction (org.apache.ojb.tools.mapping.reversedb.gui.JFrmMainFrame pmainFrame)
    {
      super();
      mainFrame = pmainFrame;
      this.putValue(NAME, "Save XML");
    }
    
    public void actionPerformed (java.awt.event.ActionEvent actionEvent)
    {
      // 1. Open a Filechooser dialog to get the path for the XML file to 
      // generate
      javax.swing.JFileChooser fileChooser = new javax.swing.JFileChooser();
      int rc = fileChooser.showSaveDialog(mainFrame);
      if (rc == javax.swing.JFileChooser.APPROVE_OPTION)
      {
        java.io.File f = fileChooser.getSelectedFile();
        try
        {
          if (!f.exists()) f.createNewFile();
          if (f.canWrite())
          {
            java.io.PrintWriter pw = 
              new java.io.PrintWriter(new java.io.FileOutputStream(f));
            mainFrame.getDBMeta().writeXML(pw);
            pw.close();          
          }
        }        
        catch (java.io.FileNotFoundException fnfe)
        {
          fnfe.printStackTrace();
        }
        catch (java.io.IOException ioex)
        {
          ioex.printStackTrace();
        }
      }
    }
    
  }
  
  /***************************** Changelog *****************************
  // $Log: SaveXMLAction.java,v $
  // Revision 1.1  2004/05/05 16:38:25  arminw
  // fix fault
  // wrong package structure used:
  // org.apache.ojb.tools.reversdb
  // org.apache.ojb.tools.reversdb2
  //
  // instead of
  // org.apache.ojb.tools.mapping.reversdb
  // org.apache.ojb.tools.mapping.reversdb2
  //
  // Revision 1.1  2004/05/04 13:44:59  arminw
  // move reverseDB stuff
  //
  // Revision 1.7  2004/04/05 12:16:24  tomdz
  // Fixed/updated license in files leftover from automatic license transition
  //
  // Revision 1.6  2004/04/04 23:53:42  brianm
  // Fixed initial copyright dates to match cvs repository
  //
  // Revision 1.5  2004/03/11 18:16:23  brianm
  // ASL 2.0
  //
  // Revision 1.4  2003/06/21 10:40:06  florianbruckner
  // improve error reporting; use writeXML(PrintWriter) instead of getXML()
  //
  // Revision 1.3  2002/11/08 13:47:38  brj
  // corrected some compiler warnings
  //
  // Revision 1.2  2002/06/17 19:34:34  jvanzyl
  // Correcting all the package references.
  // PR:
  // Obtained from:
  // Submitted by:
  // Reviewed by:
  //
  // Revision 1.1.1.1  2002/06/17 18:16:54  jvanzyl
  // Initial OJB import
  //
  // Revision 1.2  2002/05/16 11:47:09  florianbruckner
  // fix CR/LF issue, change license to ASL
  //
  // Revision 1.1  2002/04/18 11:44:16  mpoeschl
  //
  // move files to new location
  //
  // Revision 1.1  2002/03/04 17:19:33  thma
  // initial checking for Florians Reverse engineering tool
  //
  // Revision 1.1.1.1  2002/02/20 13:35:25  Administrator
  // initial import
  //
  /***************************** Changelog *****************************/
  
  
  
  1.1                  db-ojb/src/tools/org/apache/ojb/tools/mapping/reversedb/gui/actions/SetPackageAction.java
  
  Index: SetPackageAction.java
  ===================================================================
  package org.apache.ojb.tools.mapping.reversedb.gui.actions;
  
  /* Copyright 2002-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.
   */
   
  /**
   *
   * @author <a href="mailto:bfl@florianbruckner.com">Florian Bruckner</a> 
   * @version $Id: SetPackageAction.java,v 1.1 2004/05/05 16:38:25 arminw Exp $
   */
  public class SetPackageAction extends javax.swing.AbstractAction
  {
    org.apache.ojb.tools.mapping.reversedb.gui.JFrmMainFrame mainFrame;
    
    /** Creates a new instance of SetPackageAction */
    public SetPackageAction (org.apache.ojb.tools.mapping.reversedb.gui.JFrmMainFrame pmainFrame)
    {
      super();
      mainFrame = pmainFrame;
      this.putValue(NAME, "Set Package");
    }
    
    public void actionPerformed (java.awt.event.ActionEvent actionEvent)
    {
      String strPackageName = javax.swing.JOptionPane.showInputDialog(
        mainFrame, "Enter the package name you wish to set", 
        "Set Package Name", javax.swing.JOptionPane.QUESTION_MESSAGE);
      if (strPackageName != null)
        mainFrame.getDBMeta().setPackage(strPackageName);
    }
  }
  
  /***************************** Changelog *****************************
  // $Log: SetPackageAction.java,v $
  // Revision 1.1  2004/05/05 16:38:25  arminw
  // fix fault
  // wrong package structure used:
  // org.apache.ojb.tools.reversdb
  // org.apache.ojb.tools.reversdb2
  //
  // instead of
  // org.apache.ojb.tools.mapping.reversdb
  // org.apache.ojb.tools.mapping.reversdb2
  //
  // Revision 1.1  2004/05/04 13:44:59  arminw
  // move reverseDB stuff
  //
  // Revision 1.6  2004/04/05 12:16:24  tomdz
  // Fixed/updated license in files leftover from automatic license transition
  //
  // Revision 1.5  2004/04/04 23:53:42  brianm
  // Fixed initial copyright dates to match cvs repository
  //
  // Revision 1.4  2004/03/11 18:16:23  brianm
  // ASL 2.0
  //
  // Revision 1.3  2002/11/08 13:47:38  brj
  // corrected some compiler warnings
  //
  // Revision 1.2  2002/06/17 19:34:34  jvanzyl
  // Correcting all the package references.
  // PR:
  // Obtained from:
  // Submitted by:
  // Reviewed by:
  //
  // Revision 1.1.1.1  2002/06/17 18:16:54  jvanzyl
  // Initial OJB import
  //
  // Revision 1.2  2002/05/16 11:47:09  florianbruckner
  // fix CR/LF issue, change license to ASL
  //
  // Revision 1.1  2002/04/18 11:44:16  mpoeschl
  //
  // move files to new location
  //
  // Revision 1.2  2002/04/07 09:05:17  thma
  // *** empty log message ***
  //
  // Revision 1.1.1.1  2002/02/20 13:35:25  Administrator
  // initial import
  //
  /***************************** Changelog *****************************/
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org