예제 #1
0
  /** execute map reduce */
  private void executeMapReduce() throws Exception {
    String strMap = textMap.getText();
    String strReduce = textReduce.getText();
    String strFinilize = textFinalize.getText();
    String strOutputTarget = textOutputTarget.getText();
    MapReduceCommand.OutputType outputType =
        (MapReduceCommand.OutputType) comboOutputType.getData(comboOutputType.getText());

    DBObject dbQuery = null;
    if (!"".equals(textQuery.getText())) dbQuery = (DBObject) JSON.parse(textQuery.getText());

    DBObject dbSort = null;
    if (!"".equals(textSort.getText())) dbSort = (DBObject) JSON.parse(textSort.getText());

    // 쿼리 합니다.
    DBCollection dbCol = MongoDBQuery.findCollection(userDB, initColName);
    MapReduceCommand mrCmd =
        new MapReduceCommand(dbCol, strMap, strReduce, strOutputTarget, outputType, dbQuery);
    if (!"".equals(strFinilize)) mrCmd.setFinalize(strFinilize);
    if (dbSort != null) mrCmd.setSort(dbSort);
    if (getLimit() > 0) mrCmd.setLimit(getLimit());
    if (btnJsMode.getSelection()) mrCmd.addExtraOption("jsMode", true);

    final BasicDBObject searchObj = (BasicDBObject) mrCmd.toDBObject();
    if (btnSharded.getSelection()) ((BasicDBObject) searchObj.get("out")).put("sharded", true);
    if (btnNoneAtomic.getSelection()) ((BasicDBObject) searchObj.get("out")).put("nonAtomic", true);

    goMapReduce(dbCol, searchObj, outputType);
  }
예제 #2
0
  private void reloadChannelCombo(Combo combo, List channels, int selected, String prefix) {
    if (!(combo.getData() instanceof List) || isDifferentList(channels, (List) combo.getData())) {
      combo.removeAll();
      combo.setData(channels);
      for (int i = 0; i < channels.size(); i++) {
        Integer channel = (Integer) channels.get(i);

        combo.add(prefix + " #" + channel.toString());
      }
    }
    for (int i = 0; i < channels.size(); i++) {
      Integer channel = (Integer) channels.get(i);
      if (channel.intValue() == selected) {
        combo.select(i);
      }
    }
  }
예제 #3
0
 /** change ui locale */
 private void changeUILocale() {
   Object objLanguage = comboLanguage.getData(comboLanguage.getText());
   if (objLanguage == null) {
     changeUILocale(comboLanguage.getItem(0));
   } else {
     changeUILocale(comboLanguage.getText());
   }
 }
  /** Returns the selected type in the type dropdown control */
  private TypeInfo getSelectedType() {
    int index = mTypeCombo.getSelectionIndex();
    if (index != -1) {
      TypeInfo[] types = (TypeInfo[]) mTypeCombo.getData();
      return types[index];
    }

    return null;
  }
예제 #5
0
 protected void okPressed() {
   if ("".equals(sourceItemCombo.getText()) || SELECT_SENTENCE.equals(sourceItemCombo.getText())) {
     MessageDialog.openInformation(this.getShell(), "提示", "请选择触发项");
     sourceItemCombo.setFocus();
     return;
   }
   sourceItem = (MenuItem) sourceItemCombo.getData(sourceItemCombo.getText());
   super.okPressed();
 }
  /** Returns the selected index in the type dropdown control */
  private int getTypeComboIndex(TypeInfo type) {
    TypeInfo[] types = (TypeInfo[]) mTypeCombo.getData();
    for (int i = 0, n = types.length; i < n; i++) {
      if (type == types[i]) {
        return i;
      }
    }

    return -1;
  }
 /** Updates the selected type in the type dropdown control */
 private void setSelectedType(TypeInfo type) {
   TypeInfo[] types = (TypeInfo[]) mTypeCombo.getData();
   if (types != null) {
     for (int i = 0, n = types.length; i < n; i++) {
       if (types[i] == type) {
         mTypeCombo.select(i);
         break;
       }
     }
   }
 }
 private void initialSelectType() {
   TypeInfo[] types = (TypeInfo[]) mTypeCombo.getData();
   int typeIndex = getTypeComboIndex(mValues.type);
   if (typeIndex == -1) {
     typeIndex = 0;
   } else {
     assert mValues.type == types[typeIndex];
   }
   mTypeCombo.select(typeIndex);
   onSelectType(types[typeIndex]);
   updateRootCombo(types[typeIndex]);
 }
예제 #9
0
  /**
   * change ui locale
   *
   * @param strComoboStr
   */
  private void changeUILocale(String strComoboStr) {
    Locale localeSelect = (Locale) comboLanguage.getData(strComoboStr);
    RWT.getUISession().setLocale(localeSelect);

    btnCheckButton.setText(Messages.get().LoginDialog_9);
    lblEmail.setText(Messages.get().LoginDialog_1);
    lblPassword.setText(Messages.get().LoginDialog_4);
    lblLanguage.setText(Messages.get().LoginDialog_lblLanguage_text);

    compositeLetter.setText(Messages.get().LoginDialog_grpShowInformation_text);
    lblSite.setText(Messages.get().LoginDialog_lblSite_text);
    lblUserGuide.setText(Messages.get().LoginDialog_lblUserGuide_text);
    lblContact.setText(Messages.get().LoginDialog_lblContact_text_1);

    compositeLetter.layout();
    compositeLogin.layout();
  }
예제 #10
0
  private void savePreferences() {
    // validate port string
    try {
      new PortIterator(portsText.getText());
    } catch (Exception e) {
      tabFolder.setSelection(portsTabItem);
      portsText.forceFocus();
      throw new FetcherException("unparseablePortString", e);
    }

    scannerConfig.selectedPinger =
        (String) pingersCombo.getData(Integer.toString(pingersCombo.getSelectionIndex()));
    if (!pingerRegistry.checkSelectedPinger()) {
      tabFolder.setSelection(scanningTabItem);
      pingersCombo.forceFocus();
      throw new FetcherException("unsupportedPinger");
    }

    scannerConfig.maxThreads = parseIntValue(maxThreadsText);
    scannerConfig.threadDelay = parseIntValue(threadDelayText);
    scannerConfig.pingCount = parseIntValue(pingingCountText);
    scannerConfig.pingTimeout = parseIntValue(pingingTimeoutText);
    scannerConfig.scanDeadHosts = deadHostsCheckbox.getSelection();
    scannerConfig.skipBroadcastAddresses = skipBroadcastsCheckbox.getSelection();
    scannerConfig.portTimeout = parseIntValue(portTimeoutText);
    scannerConfig.adaptPortTimeout = adaptTimeoutCheckbox.getSelection();
    scannerConfig.minPortTimeout = parseIntValue(minPortTimeoutText);
    scannerConfig.portString = portsText.getText();
    scannerConfig.useRequestedPorts = addRequestedPortsCheckbox.getSelection();
    scannerConfig.notAvailableText = notAvailableText.getText();
    scannerConfig.notScannedText = notScannedText.getText();
    for (int i = 0; i < displayMethod.length; i++) {
      if (displayMethod[i].getSelection()) guiConfig.displayMethod = DisplayMethod.values()[i];
    }
    guiConfig.showScanStats = showInfoCheckbox.getSelection();
    guiConfig.askScanConfirmation = askConfirmationCheckbox.getSelection();
  }
  @Override
  public boolean makeUserDBDao(boolean isTest) {
    if (!isValidateInput(isTest)) return false;

    DBDefine selectDB = (DBDefine) comboDriverType.getData(comboDriverType.getText());

    String dbUrl =
        String.format(
            selectDB.getDB_URL_INFO(),
            StringUtils.trimToEmpty(textHost.getText()),
            StringUtils.trimToEmpty(textPort.getText()),
            StringUtils.trimToEmpty(textDatabase.getText()));

    if (!"".equals(textJDBCOptions.getText())) {
      dbUrl += "?" + textJDBCOptions.getText();
    }

    userDB = new UserDBDAO();
    userDB.setDbms_type(selectDB.getDBToString());
    userDB.setUrl(dbUrl);
    userDB.setUrl_user_parameter(textJDBCOptions.getText());
    userDB.setDb(StringUtils.trimToEmpty(textDatabase.getText()));
    userDB.setGroup_name(StringUtils.trimToEmpty(preDBInfo.getComboGroup().getText()));
    userDB.setDisplay_name(StringUtils.trimToEmpty(preDBInfo.getTextDisplayName().getText()));
    userDB.setOperation_type(
        PublicTadpoleDefine.DBOperationType.getNameToType(
                preDBInfo.getComboOperationType().getText())
            .toString());
    userDB.setHost(StringUtils.trimToEmpty(textHost.getText()));
    userDB.setPort(StringUtils.trimToEmpty(textPort.getText()));
    userDB.setUsers(StringUtils.trimToEmpty(textUser.getText()));
    userDB.setPasswd(StringUtils.trimToEmpty(textPassword.getText()));

    // others connection 정보를 입력합니다.
    //		setOtherConnectionInfo();
    OthersConnectionInfoDAO otherConnectionDAO = othersConnectionInfo.getOthersConnectionInfo();
    userDB.setIs_readOnlyConnect(
        otherConnectionDAO.isReadOnlyConnection()
            ? PublicTadpoleDefine.YES_NO.YES.name()
            : PublicTadpoleDefine.YES_NO.NO.name());
    userDB.setIs_autocommit(
        otherConnectionDAO.isAutoCommit()
            ? PublicTadpoleDefine.YES_NO.YES.name()
            : PublicTadpoleDefine.YES_NO.NO.name());
    userDB.setIs_showtables(
        otherConnectionDAO.isShowTables()
            ? PublicTadpoleDefine.YES_NO.YES.name()
            : PublicTadpoleDefine.YES_NO.NO.name());

    //
    //	userDB.setIs_table_filter(otherConnectionDAO.isTableFilter()?PublicTadpoleDefine.YES_NO.YES.name():PublicTadpoleDefine.YES_NO.NO.name());
    //		userDB.setTable_filter_include(otherConnectionDAO.getStrTableFilterInclude());
    //		userDB.setTable_filter_exclude(otherConnectionDAO.getStrTableFilterExclude());

    userDB.setIs_profile(
        otherConnectionDAO.isProfiling()
            ? PublicTadpoleDefine.YES_NO.YES.name()
            : PublicTadpoleDefine.YES_NO.NO.name());
    userDB.setQuestion_dml(
        otherConnectionDAO.isDMLStatement()
            ? PublicTadpoleDefine.YES_NO.YES.name()
            : PublicTadpoleDefine.YES_NO.NO.name());

    userDB.setIs_external_browser(
        otherConnectionDAO.isExterBrowser()
            ? PublicTadpoleDefine.YES_NO.YES.name()
            : PublicTadpoleDefine.YES_NO.NO.name());

    // 처음 등록자는 권한이 어드민입니다.
    userDB.setRole_id(PublicTadpoleDefine.USER_ROLE_TYPE.ADMIN.toString());

    return true;
  }
예제 #12
0
 public DropDownData getDropDownData() {
   DropDownData dropData = (DropDownData) top.getData();
   assert (dropData != null);
   return dropData;
 }