Examples of ConnectionSettings


Examples of com.dci.intellij.dbn.connection.config.ConnectionSettings

        } else {
            listChanged = true;
        }

        for (int i=0; i< listModel.getSize(); i++) {
            ConnectionSettings connectionSettings = (ConnectionSettings) listModel.getElementAt(i);
            connectionSettings.apply();

            ConnectionHandler connectionHandler = connectionBundle.getConnection(connectionSettings.getDatabaseSettings().getId());
            if (connectionHandler == null) {
                connectionHandler = new ConnectionHandlerImpl(connectionBundle, connectionSettings);
                connectionSettings.getDatabaseSettings().setNew(false);
            } else {
                oldConnections.remove(connectionHandler);
                ((ConnectionHandlerImpl)connectionHandler).setConnectionConfig(connectionSettings);
            }
View Full Code Here

Examples of com.dci.intellij.dbn.connection.config.ConnectionSettings

    }

    public void resetChanges() {
        ConnectionListModel listModel = (ConnectionListModel) connectionsList.getModel();
        for (int i=0; i< listModel.getSize(); i++) {
            ConnectionSettings connectionSettings = (ConnectionSettings) listModel.getElementAt(i);
            connectionSettings.reset();
        }
    }
View Full Code Here

Examples of com.dci.intellij.dbn.connection.config.ConnectionSettings

    public void valueChanged(ListSelectionEvent listSelectionEvent) {
        try {
            Object[] selectedValues = connectionsList.getSelectedValues();
            if (selectedValues.length == 1) {
                ConnectionSettings connectionSettings = (ConnectionSettings) selectedValues[0];
                switchSettingsPanel(connectionSettings);
            } else {
                switchSettingsPanel(null);
            }
        } catch (IndexOutOfBoundsException e) {
View Full Code Here

Examples of connection.ConnectionSettings

   
    ArrayList<String> performOnConnect = new ArrayList<>();
    for (String cmd : textPerform.getText().split(Message.NEW_LINE))
      performOnConnect.add(cmd);
   
    ConnectionSettings newCS = new ConnectionSettings(textServer.getText(),
                    textNick.getText());
   
    if(!textConnName.getText().isEmpty())
      newCS.setConnectionName(textConnName.getText());
   
    newCS.setPort(Integer.parseInt(textPort.getText()));
    newCS.setServerPassword(textServPass.getText());
    newCS.setSsl(btnUseSsl.getSelection());
    newCS.setConnectOnStart(btnConnectOnStartup.getSelection());
    newCS.setNickPassword(textNickPass.getText());
    if(!textIdent.getText().isEmpty()) 
      newCS.setIdent(textIdent.getText());
    newCS.setAutoJoin(autoJoin);
    newCS.setPerformOnConnect(performOnConnect);
   
    table.getItem(table.getSelectionIndex()).setData(newCS);
    table.getItem(table.getSelectionIndex()).setText(
        new String[] { newCS.getConnectionName(),
            newCS.getServer(), newCS.getNickname() });
    saveTable();
  }
View Full Code Here

Examples of connection.ConnectionSettings

   * Clear blanks.
   */
  private void clearBlanks() {
    TableItem[] items = table.getItems();
    for (int k = items.length - 1; k >= 0; k--) {
      ConnectionSettings cs = ((ConnectionSettings)items[k].getData());
      if (cs == null || cs.getNickname().isEmpty() &&
          cs.getServer().isEmpty() && cs.getConnectionName().isEmpty())
        table.remove(k);
    }
  }
View Full Code Here

Examples of connection.ConnectionSettings

    boolean completed = checkIfCompleted();
    if (table.getSelectionCount() == 1 && completed) {
      // save stuff
      saveEntry();
      //connect
      ConnectionSettings selected = (ConnectionSettings) table.getItem(
          table.getSelectionIndex()).getData();
      new Connection(RoomManager.getMain().getContainer(), SWT.NONE,
          selected);
    }
    else if(!completed)
View Full Code Here

Examples of net.bnubot.core.ConnectionSettings

      numBots = Integer.parseInt(
        Settings.read("bnubot", "numBots", "1"));
    } catch(Exception e) {}
    Settings.write("bnubot", "numBots", Integer.toString(numBots));
   
    ConnectionSettings cs = new ConnectionSettings();
    cs.load(1);
   
    boolean forceConfig = false;
    String plugins[] = null;
   
    for(int i = 0; i < args.length; i++) {
      if(args[i].charAt(0) == '-') {
        switch(args[i].charAt(1)) {
        case 'c':
          if(args[i].equals("-cli")) {
            cs.enableCLI = true;
            continue;
          }
          if(args[i].equals("-cfg")) {
            forceConfig = true;
            continue;
          }
          break;
        case 'g':
          if(args[i].equals("-gui")) {
            cs.enableGUI = true;
            continue;
          }
          break;
        case 'l':
          if(args[i].equals("-logfile")) {
            Out.setOutputStream(new PrintStream(new File(args[++i])));
            continue;
          }
          break;
        case 'n':
          if(args[i].equals("-nocli")) {
            cs.enableCLI = false;
            continue;
          }
          if(args[i].equals("-nogui")) {
            cs.enableGUI = false;
            continue;
          }
          break;
        case 'p':
          if(args[i].equals("-plugins")) {
            plugins = args[++i].split(":");
            continue;
          }
          break;
        }
      }
     
      Out.error("Main", "Invalid argument: " + args[i]);
      System.exit(1);
    }
   
    if((cs.isValid() != null) || forceConfig) {
      ConfigurationFrame cf = null;
      try {
        cf = new ConfigurationFrame(cs);
        cf.setVisible(true);
      } catch(Exception e) {
        e.printStackTrace();
        String s = cs.isValid();
        String error = "There was an error initializing the configuraiton window, ";
        if(s == null)
          error += "but the configuration was valid.";
        else
          error += "and the configuration was invalid: " + s;
        Out.error("Main", error);
        System.exit(1);
      }
     
      while(cf.isVisible()) {
        Thread.yield();
        Thread.sleep(10);
      }
     
      String reason = cs.isValid();
      if(reason != null) {
        JOptionPane.showMessageDialog(null, reason, "Invalid Configuration", JOptionPane.ERROR_MESSAGE);
        System.exit(1);
      }
    }
   
    ChatQueue cq = new ChatQueue();
    cq.start();
   
    BNCSConnection primary = new BNCSConnection(cs, cq);
     
    //Other plugins
    ArrayList<EventHandler> pluginEHs = new ArrayList<EventHandler>();
    if(plugins != null) {
      for(int i = 0; i < plugins.length; i++) {
        EventHandler eh = (EventHandler)Class.forName(plugins[i]).newInstance();
        pluginEHs.add(eh);
        primary.addEventHandler(eh);
      }
    }
   
    //CLI
    EventHandler cli = null;
    if(cs.enableCLI) {
      cli = new ConsoleEventHandler();
      primary.addEventHandler(cli);
    }
   
    //GUI
    EventHandler gui = null;
    if(cs.enableGUI) {
      gui = new GuiEventHandler();
      primary.addEventHandler(gui);
    }
   
    //Bot
    EventHandler cmd = null;
    if(cs.enableCommands) {
      String db_driver = Settings.read("database", "driver", "org.apache.derby.jdbc.EmbeddedDriver");
      String db_url = Settings.read("database", "url", "jdbc:derby:database;create=true");
      String db_username = Settings.read("database", "username", null);
      String db_password = Settings.read("database", "password", null);
      String db_schema = Settings.read("database", "schema", "schema.derby");
     
      if((db_driver == null)
      || (db_url == null)) {
        if(gui != null)
          primary.recieveInfo("Database is not configured; disabling commands.");
        else
          Out.info("main", "Database is not configured; disabling commands.");
      } else {
        try {
          new Database(db_driver, db_url, db_username, db_password, db_schema);
          BNetUser.setDatabase();
          cmd = new CommandEventHandler();
          primary.addEventHandler(cmd);
         
          Settings.write("database", "driver", db_driver);
          Settings.write("database", "url", db_url);
          Settings.write("database", "username", db_username);
          Settings.write("database", "password", db_password);
          Settings.write("database", "schema", db_schema);
        } catch(Exception e) {
          e.printStackTrace();
          String msg = "Failed to initialize the database; commands will be disabled.\n" + e.getMessage();
          if(gui != null)
            primary.recieveError(msg);
          else
            Out.error("Main", msg);
        }
      }
    }
   
    //Trivia
    if(cs.enableTrivia) {
      EventHandler trivia = new TriviaEventHandler();
      primary.addEventHandler(trivia);
    }
   
    try {
      VersionCheck.checkVersion(primary);
    } catch(Exception e) {
      e.printStackTrace();
    }
   
    primary.start();
    BNCSConnection c = primary;
   
    for(int i = 2; i <= numBots; i++) {
      //Wait for the previous bot to connect
      while(!c.canSendChat())
        Thread.sleep(20);
     
      //Wait an additional 500ms
      Thread.sleep(500);
     
      //Start up the next connection
      cs = new ConnectionSettings();
      cs.load(i);
      String valid = cs.isValid();
      if(valid != null)
        throw new Exception("Invalid configuration for bot " + i + ": " + valid);
 
      c = new BNCSConnection(cs, cq);
      for(EventHandler eh : pluginEHs)
View Full Code Here

Examples of net.bnubot.settings.ConnectionSettings

            continue; // Fool me twice, shame on me

          while(username.charAt(0) < 0x20)
            username = username.substring(1);

          ConnectionSettings cs = pri.getConnectionSettings();
          if(!username.equalsIgnoreCase(cs.username)) {
            sendInternal("1019 Error \"Invalid username\"");
            continue;
          }
View Full Code Here

Examples of net.bnubot.settings.ConnectionSettings

    }
    GlobalSettings.save();
  }

  public static void newConnection(int newConnectionId) {
    ConnectionSettings cs = new ConnectionSettings(newConnectionId);
    try {
      add(cs);
    } catch (Exception e) {
      Out.exception(e);
    }
View Full Code Here

Examples of net.bnubot.settings.ConnectionSettings

   * @param lastModified when the file was modified last
   * @return the <code>File</code>, or null if there was an error
   * @throws Exception
   */
  public static File downloadFile(String fileName) throws Exception {
    return downloadFile(new ConnectionSettings(1), fileName, null, defaultPath);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.