Skript pro spouštění a hesla k DB.
authorFrantišek Kučera <franta-hg@frantovo.cz>
Fri, 01 Jan 2010 16:44:46 +0100
changeset 45816c7f61a2a
parent 3 d40099dbbdd1
child 5 ed73b8912549
Skript pro spouštění a hesla k DB.
.hgignore
java/abc-drupal-gui/src/cz/frantovo/abcDrupal/Konvertor.java
java/abc-drupal-gui/src/cz/frantovo/abcDrupal/gui/HlavniOkno.form
java/abc-drupal-gui/src/cz/frantovo/abcDrupal/gui/HlavniOkno.java
java/abc-drupal-gui/start.sh
     1.1 --- a/.hgignore	Thu Dec 31 18:41:04 2009 +0100
     1.2 +++ b/.hgignore	Fri Jan 01 16:44:46 2010 +0100
     1.3 @@ -2,3 +2,4 @@
     1.4  java/abc-drupal-gui/build/*
     1.5  java/abc-drupal-gui/nbproject/private/*
     1.6  java/abc-drupal-gui/lib/*
     1.7 +java/abc-drupal-gui/hesla.sh
     2.1 --- a/java/abc-drupal-gui/src/cz/frantovo/abcDrupal/Konvertor.java	Thu Dec 31 18:41:04 2009 +0100
     2.2 +++ b/java/abc-drupal-gui/src/cz/frantovo/abcDrupal/Konvertor.java	Fri Jan 01 16:44:46 2010 +0100
     2.3 @@ -1,5 +1,8 @@
     2.4  package cz.frantovo.abcDrupal;
     2.5  
     2.6 +import java.sql.Connection;
     2.7 +import java.sql.DriverManager;
     2.8 +import java.sql.SQLException;
     2.9  import java.util.Date;
    2.10  
    2.11  /**
    2.12 @@ -8,9 +11,11 @@
    2.13   */
    2.14  public class Konvertor {
    2.15  
    2.16 +    private PosluchacLogu posluchacLogu;
    2.17      private String jdbcZdroj;
    2.18      private String jdbcCil;
    2.19 -    private PosluchacLogu posluchacLogu;
    2.20 +    private Connection dbZdroj;
    2.21 +    private Connection dbCil;
    2.22  
    2.23      public Konvertor(String jdbcZdroj, String jdbcCil, PosluchacLogu posluchacLogu) {
    2.24  	this.jdbcZdroj = jdbcZdroj;
    2.25 @@ -20,8 +25,17 @@
    2.26  
    2.27      public void konvertuj() {
    2.28  	vypis("Začíná migrace");
    2.29 +
    2.30 +
    2.31 +
    2.32 +
    2.33  	vypis("Migrace dokončena");
    2.34      }
    2.35 +    
    2.36 +    private void nastavDBspojeni() throws SQLException {
    2.37 +	dbZdroj = DriverManager.getConnection("");
    2.38 +    }
    2.39 +
    2.40  
    2.41      private void vypis(String zprava) {
    2.42  	if (posluchacLogu != null) {
     3.1 --- a/java/abc-drupal-gui/src/cz/frantovo/abcDrupal/gui/HlavniOkno.form	Thu Dec 31 18:41:04 2009 +0100
     3.2 +++ b/java/abc-drupal-gui/src/cz/frantovo/abcDrupal/gui/HlavniOkno.form	Fri Jan 01 16:44:46 2010 +0100
     3.3 @@ -38,7 +38,7 @@
     3.4                            <Component id="jdbcZdroj" alignment="0" pref="560" max="32767" attributes="0"/>
     3.5                        </Group>
     3.6                    </Group>
     3.7 -                  <Component id="jButton1" alignment="1" min="-2" max="-2" attributes="0"/>
     3.8 +                  <Component id="nahratData" alignment="1" min="-2" max="-2" attributes="0"/>
     3.9                </Group>
    3.10                <EmptySpace max="-2" attributes="0"/>
    3.11            </Group>
    3.12 @@ -60,7 +60,7 @@
    3.13                <EmptySpace max="-2" attributes="0"/>
    3.14                <Component id="jScrollPane1" pref="152" max="32767" attributes="0"/>
    3.15                <EmptySpace max="-2" attributes="0"/>
    3.16 -              <Component id="jButton1" min="-2" max="-2" attributes="0"/>
    3.17 +              <Component id="nahratData" min="-2" max="-2" attributes="0"/>
    3.18                <EmptySpace max="-2" attributes="0"/>
    3.19            </Group>
    3.20        </Group>
    3.21 @@ -79,12 +79,12 @@
    3.22      </Component>
    3.23      <Component class="javax.swing.JTextField" name="jdbcZdroj">
    3.24        <Properties>
    3.25 -        <Property name="text" type="java.lang.String" value="jdbcZdroj"/>
    3.26 +        <Property name="text" type="java.lang.String" value="jdbc:mysql://127.0.0.1:3306/itbiz?user=itbiz&amp;password=nbusr123"/>
    3.27        </Properties>
    3.28      </Component>
    3.29      <Component class="javax.swing.JTextField" name="jdbcCil">
    3.30        <Properties>
    3.31 -        <Property name="text" type="java.lang.String" value="jdbcCil"/>
    3.32 +        <Property name="text" type="java.lang.String" value="jdbc:mysql://127.0.0.1:3306/abclinuxu?user=abclinuxu&amp;password=nbusr123"/>
    3.33        </Properties>
    3.34      </Component>
    3.35      <Container class="javax.swing.JScrollPane" name="jScrollPane1">
    3.36 @@ -104,12 +104,12 @@
    3.37          </Component>
    3.38        </SubComponents>
    3.39      </Container>
    3.40 -    <Component class="javax.swing.JButton" name="jButton1">
    3.41 +    <Component class="javax.swing.JButton" name="nahratData">
    3.42        <Properties>
    3.43          <Property name="text" type="java.lang.String" value="Nahr&#xe1;t data"/>
    3.44        </Properties>
    3.45        <Events>
    3.46 -        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
    3.47 +        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="nahratDataActionPerformed"/>
    3.48        </Events>
    3.49      </Component>
    3.50    </SubComponents>
     4.1 --- a/java/abc-drupal-gui/src/cz/frantovo/abcDrupal/gui/HlavniOkno.java	Thu Dec 31 18:41:04 2009 +0100
     4.2 +++ b/java/abc-drupal-gui/src/cz/frantovo/abcDrupal/gui/HlavniOkno.java	Fri Jan 01 16:44:46 2010 +0100
     4.3 @@ -25,6 +25,7 @@
     4.4      /** Creates new form HlavniOkno */
     4.5      public HlavniOkno() {
     4.6  	initComponents();
     4.7 +	setLocationRelativeTo(null);
     4.8  	nactiPromenneProstredi();
     4.9      }
    4.10  
    4.11 @@ -54,7 +55,7 @@
    4.12          jdbcCil = new javax.swing.JTextField();
    4.13          jScrollPane1 = new javax.swing.JScrollPane();
    4.14          vystup = new javax.swing.JTextArea();
    4.15 -        jButton1 = new javax.swing.JButton();
    4.16 +        nahratData = new javax.swing.JButton();
    4.17  
    4.18          setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    4.19          setTitle("ABC-Drupal");
    4.20 @@ -63,9 +64,9 @@
    4.21  
    4.22          jLabel2.setText("Cíl");
    4.23  
    4.24 -        jdbcZdroj.setText("jdbcZdroj");
    4.25 +        jdbcZdroj.setText("jdbc:mysql://127.0.0.1:3306/itbiz?user=itbiz&password=nbusr123");
    4.26  
    4.27 -        jdbcCil.setText("jdbcCil");
    4.28 +        jdbcCil.setText("jdbc:mysql://127.0.0.1:3306/abclinuxu?user=abclinuxu&password=nbusr123");
    4.29  
    4.30          vystup.setColumns(20);
    4.31          vystup.setEditable(false);
    4.32 @@ -73,10 +74,10 @@
    4.33          vystup.setEnabled(false);
    4.34          jScrollPane1.setViewportView(vystup);
    4.35  
    4.36 -        jButton1.setText("Nahrát data");
    4.37 -        jButton1.addActionListener(new java.awt.event.ActionListener() {
    4.38 +        nahratData.setText("Nahrát data");
    4.39 +        nahratData.addActionListener(new java.awt.event.ActionListener() {
    4.40              public void actionPerformed(java.awt.event.ActionEvent evt) {
    4.41 -                jButton1ActionPerformed(evt);
    4.42 +                nahratDataActionPerformed(evt);
    4.43              }
    4.44          });
    4.45  
    4.46 @@ -96,7 +97,7 @@
    4.47                          .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    4.48                              .addComponent(jdbcCil, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE)
    4.49                              .addComponent(jdbcZdroj, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE)))
    4.50 -                    .addComponent(jButton1))
    4.51 +                    .addComponent(nahratData))
    4.52                  .addContainerGap())
    4.53          );
    4.54          layout.setVerticalGroup(
    4.55 @@ -113,17 +114,17 @@
    4.56                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    4.57                  .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE)
    4.58                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    4.59 -                .addComponent(jButton1)
    4.60 +                .addComponent(nahratData)
    4.61                  .addContainerGap())
    4.62          );
    4.63  
    4.64          pack();
    4.65      }// </editor-fold>//GEN-END:initComponents
    4.66  
    4.67 -    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    4.68 +    private void nahratDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nahratDataActionPerformed
    4.69  	Konvertor k = new Konvertor(jdbcZdroj.getText(), jdbcCil.getText(), this);
    4.70  	k.konvertuj();
    4.71 -    }//GEN-LAST:event_jButton1ActionPerformed
    4.72 +    }//GEN-LAST:event_nahratDataActionPerformed
    4.73  
    4.74      /**
    4.75       * @param args the command line arguments
    4.76 @@ -147,12 +148,12 @@
    4.77  	}
    4.78      }
    4.79      // Variables declaration - do not modify//GEN-BEGIN:variables
    4.80 -    private javax.swing.JButton jButton1;
    4.81      private javax.swing.JLabel jLabel1;
    4.82      private javax.swing.JLabel jLabel2;
    4.83      private javax.swing.JScrollPane jScrollPane1;
    4.84      private javax.swing.JTextField jdbcCil;
    4.85      private javax.swing.JTextField jdbcZdroj;
    4.86 +    private javax.swing.JButton nahratData;
    4.87      private javax.swing.JTextArea vystup;
    4.88      // End of variables declaration//GEN-END:variables
    4.89  
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/java/abc-drupal-gui/start.sh	Fri Jan 01 16:44:46 2010 +0100
     5.3 @@ -0,0 +1,9 @@
     5.4 +#!/bin/bash
     5.5 +
     5.6 +# Soubor obsahující hesla k DB – nastavuje níže uvedené proměnné
     5.7 +source hesla.sh;
     5.8 +# MIGRACE_ZDROJ="jdbc:mysql://127.0.0.1:3306/itbiz?user=itbiz&password=nbusr123";
     5.9 +# MIGRACE_ZDROJ="jdbc:mysql://127.0.0.1:3306/itbiz?user=itbiz&password=nbusr123";
    5.10 +
    5.11 +cd dist;
    5.12 +java -jar abc-drupal-gui.jar;