private void openFichierPlat() {
   File parentDirectory;
   File fileout;
   try {
     URL url =
         this.getClass()
             .getResource(
                 Messages.getString(
                     "TableDb2.resourceRepertoireFichierSortiePlat")); //$NON-NLS-1$
     parentDirectory = new File(new URI(url.toString()));
     fileout =
         new File(
             parentDirectory,
             nomTableDb2
                 + Messages.getString("TableDb2.extensionFichierSortiePlat")); // $NON-NLS-1$
     fileout.delete();
     fileout =
         new File(
             parentDirectory,
             nomTableDb2
                 + Messages.getString("TableDb2.extensionFichierSortiePlat")); // $NON-NLS-1$
     fwPlat = new FileWriter(fileout.getAbsoluteFile(), true);
     bwPlat = new BufferedWriter(fwPlat);
   } catch (URISyntaxException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
Exemplo n.º 2
0
  /**
   * Creates the geomerty input tabbed page
   *
   * @param tabbedPane The TabbedPane to add the tab to
   */
  private void getGeometryInput(JTabbedPane tabbedPane) {
    JPanel geometryInput = new JPanel(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = REMAINDER;
    gbc.fill = BOTH;
    gbc.anchor = NORTHWEST;
    gbc.weighty = 1.0;

    chainwheelGeometryInput.addContentChangeListener(this);
    geometryInput.add(chainwheelGeometryInput, gbc);

    sprocketGeometryInput.addContentChangeListener(this);
    geometryInput.add(sprocketGeometryInput, gbc);

    generalGeometryInput.addContentChangeListener(this);
    geometryInput.add(generalGeometryInput, gbc);

    driveTrainDrawing.addContentChangeListener(this);
    driveTrainOutput.addContentChangeListener(this);

    tabbedPane.addTab(
        Messages.getString("GeometryDetails"),
        null,
        geometryInput,
        Messages.getString("GeometryDetailsTip"));
  }
  /** Search employee by Id or name */
  public void searchEmp() {
    if (!LibValid.getInstance().EmpID(view.getTxtEmpID().getText())) {
      JOptionPane.showMessageDialog(
          view,
          Messages.getString("EmployeeController.25"), // $NON-NLS-1$
          Messages.getString("EmployeeController.26"),
          JOptionPane.ERROR_MESSAGE);
    } else {
      parent.removeModel(empModel);
      new Thread(
              new Runnable() {

                @Override
                public void run() {
                  totalRow =
                      AccessEmp.getInstance()
                          .searchEmp(
                              empModel,
                              view.getTxtEmpID().getText(),
                              view.getTxtEmpName().getText(),
                              (page - 1));
                  view.getLblPage()
                      .setText(
                          Messages.getString("EmployeeController.27")
                              + page
                              + Messages.getString("Slash") // $NON-NLS-1$
                              + LibUtil.getInstance().getPage(totalRow));
                }
              })
          .start();
    }
  }
 /**
  * Showing an error dialog
  *
  * @param e
  */
 private void showErrorDialog(Exception e) {
   new ErrorDialog(
       shell,
       Messages.getString("GetQueryFieldsProgressDialog.Error.Title"),
       Messages.getString("GetQueryFieldsProgressDialog.Error.Message"),
       e);
 }
  private MethodDeclaration createOptionSetter(PropertyDeclaration property) {
    assert property != null;
    SimpleName paramName = context.createVariableName("option"); // $NON-NLS-1$

    Type optionType = context.getFieldType(property);
    return f.newMethodDeclaration(
        new JavadocBuilder(f)
            .text(
                Messages.getString("ProjectiveModelEmitter.javadocOptionSetter"), // $NON-NLS-1$
                context.getDescription(property))
            .param(paramName)
            .text(
                Messages.getString(
                    "ProjectiveModelEmitter.javadocOptionSetterParameter"), //$NON-NLS-1$
                context.getDescription(property))
            .toJavadoc(),
        new AttributeBuilder(f).toAttributes(),
        Collections.emptyList(),
        context.resolve(void.class),
        context.getOptionSetterName(property),
        Arrays.asList(
            new FormalParameterDeclaration[] {
              f.newFormalParameterDeclaration(optionType, paramName)
            }),
        0,
        Collections.emptyList(),
        null);
  }
Exemplo n.º 6
0
  @Override
  public void pullRemote(CallingContext context, String raptureURIString) {
    RaptureURI internalURI = new RaptureURI(raptureURIString, Scheme.DOCUMENT);
    if (internalURI.hasDocPath()) {
      throw RaptureExceptionFactory.create(
          HttpURLConnection.HTTP_BAD_REQUEST,
          apiMessageCatalog.getMessage("NoDocPath", internalURI.toShortString())); // $NON-NLS-1$
    }
    checkParameter(NAME, internalURI.getDocPath());

    log.info(
        Messages.getString("Admin.PullPerspective")
            + Messages.getString("Admin.OnType")
            + internalURI.getDocPath() // $NON-NLS-1$ //$NON-NLS-2$
            + Messages.getString("Admin.InAuthority")
            + internalURI.getAuthority()); // $NON-NLS-1$
    // NOW this is the fun one
    // Here are the steps
    // (1) Look at the local, does it have a remote defined? If
    // so, what is the latest commit known about
    // for that remote?
    // (2) Make a remote call to retrieve the commits up to that commit from
    // the RemoteLink
    // (3) For each commit, look at all of the references, retrieve them
    // from the remote and persist them
    // into the repo.
    // (4) Update the local perspective to point at the latest commit, and
    // update the Remote commit to point at that.

    getKernel().getRepo(internalURI.getFullPath()); // $NON-NLS-1$
  }
  /** The login process starts from here. */
  public HttpResponse doCommenceLogin(
      StaplerRequest req,
      StaplerResponse rsp,
      @QueryParameter String from,
      @QueryParameter String ticket)
      throws ServletException, IOException {

    // TODO write login method
    String puid = authenticateInWwpass(ticket, certFile, keyFile);

    WwpassIdentity u;
    try {
      u = loadUserByUsername(puid);
    } catch (UsernameNotFoundException e) {
      if (allowsSignup()) {
        req.setAttribute("errorMessage", Messages.WwpassSecurityRealm_NoSuchUserAllowsSignup());
      } else {
        req.setAttribute("errorMessage", Messages.WwpassSecurityRealm_NoSuchUserDisableSignup());
      }
      req.getView(this, "login.jelly").forward(req, rsp);
      throw e;
    }
    if (!u.isAccountNonLocked() || !u.isEnabled()) {
      // throw new LockedException("Account is not activated for " + puid);
      throw new Failure(Messages.WwpassSecurityRealm_AccountNotActivated());
    }

    Authentication a = new WwpassAuthenticationToken(u.getNickname());
    a = this.getSecurityComponents().manager.authenticate(a);
    SecurityContextHolder.getContext().setAuthentication(a);

    return new HttpRedirect(Jenkins.getInstance().getRootUrl());
  }
  /**
   * The parameter must follow the syntax "page:nr" where nr is the number of the page to be
   * displayed.
   *
   * <p>
   *
   * @see org.opencms.file.collectors.I_CmsResourceCollector#getResults(org.opencms.file.CmsObject,
   *     java.lang.String, java.lang.String)
   */
  public List<CmsResource> getResults(CmsObject cms, String collectorName, String parameter)
      throws CmsException {

    synchronized (this) {
      if (LOG.isDebugEnabled()) {
        LOG.debug(Messages.get().getBundle().key(Messages.LOG_COLLECTOR_GET_RESULTS_START_0));
      }
      if (parameter == null) {
        parameter = m_collectorParameter;
      }
      List<CmsResource> resources = new ArrayList<CmsResource>();
      if (getWp().getList() != null) {
        Iterator<CmsListItem> itItems = getListItems(parameter).iterator();
        while (itItems.hasNext()) {
          CmsListItem item = itItems.next();
          resources.add(getResource(cms, item));
        }
      } else {
        Map<String, String> params =
            CmsStringUtil.splitAsMap(
                parameter,
                I_CmsListResourceCollector.SEP_PARAM,
                I_CmsListResourceCollector.SEP_KEYVAL);
        resources = getInternalResources(cms, params);
      }
      if (LOG.isDebugEnabled()) {
        LOG.debug(
            Messages.get()
                .getBundle()
                .key(Messages.LOG_COLLECTOR_GET_RESULTS_END_1, new Integer(resources.size())));
      }
      return resources;
    }
  }
Exemplo n.º 9
0
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    @SuppressWarnings("unchecked")
    Map<String, String[]> params = req.getParameterMap();

    HttpSession session = req.getSession(true);
    session.setAttribute(LANG, "en"); // Defaults to English //$NON-NLS-1$

    if (params.containsKey("lang")) { // $NON-NLS-1$
      String lang = params.get("lang")[0]; // $NON-NLS-1$
      Messages.setLang(lang);
      if (this.availableLanguages.contains(lang)) {
        session.setAttribute(LANG, lang);
        resp.getWriter()
            .print(
                Messages.getString("localeservlet.lang_set_to")
                    + lang
                    + "'"); //$NON-NLS-1$ //$NON-NLS-2$
      } else {
        resp.sendError(
            HttpServletResponse.SC_BAD_REQUEST,
            Messages.getString("localeservlet.lang_not_available")); // $NON-NLS-1$
      }
    } else {
      resp.sendError(
          HttpServletResponse.SC_BAD_REQUEST,
          Messages.getString("localeservlet.not_lang_parameter") // $NON-NLS-1$
              + this.availableLanguages.toString());
    }
  }
  // Append the changelog if we should and can
  private String createBuildNotes(String buildNotes, final ChangeLogSet<?> changeSet) {
    if (appendChangelog) {
      StringBuilder stringBuilder = new StringBuilder();

      // Show the build notes first
      stringBuilder.append(buildNotes);

      // Then append the changelog
      stringBuilder
          .append("\n\n")
          .append(
              changeSet.isEmptySet()
                  ? Messages.TestflightRecorder_EmptyChangeSet()
                  : Messages.TestflightRecorder_Changelog())
          .append("\n");

      int entryNumber = 1;

      for (Entry entry : changeSet) {
        stringBuilder.append("\n").append(entryNumber).append(". ");
        stringBuilder.append(entry.getMsg()).append(" \u2014 ").append(entry.getAuthor());

        entryNumber++;
      }
      buildNotes = stringBuilder.toString();
    }
    return buildNotes;
  }
Exemplo n.º 11
0
  public void buildPanel() {
    String path = FileUtil.getLayoutPath(layoutDir, fname);
    if (path == null) {
      Messages.postError("Could not open xml file:" + fname);
      return;
    }
    removeAll();
    try {
      LayoutBuilder.build(pane, vnmrIf, path);
    } catch (Exception e) {
      String strError = "Error building file: " + path;
      Messages.postError(strError);
      Messages.writeStackTrace(e);
      return;
    }

    if (bScrollBar) {
      spane =
          new JScrollPane(
              pane,
              JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
              JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
      add(spane);
    } else {
      spane = null;
      add(pane);
    }
    paramsLayout.preferredLayoutSize(pane);
  }
  private void addTestflightLinks(
      AbstractBuild<?, ?> build, BuildListener listener, Map parsedMap) {
    TestflightBuildAction installAction = new TestflightBuildAction();
    String installUrl = (String) parsedMap.get("install_url");
    installAction.displayName = Messages.TestflightRecorder_InstallLinkText();
    installAction.iconFileName = "package.gif";
    installAction.urlName = installUrl;
    build.addAction(installAction);
    listener.getLogger().println(Messages.TestflightRecorder_InfoInstallLink(installUrl));

    TestflightBuildAction configureAction = new TestflightBuildAction();
    String configUrl = (String) parsedMap.get("config_url");
    configureAction.displayName = Messages.TestflightRecorder_ConfigurationLinkText();
    configureAction.iconFileName = "gear2.gif";
    configureAction.urlName = configUrl;
    build.addAction(configureAction);
    listener.getLogger().println(Messages.TestflightRecorder_InfoConfigurationLink(configUrl));

    build.addAction(new EnvAction());

    // Add info about the selected build into the environment
    EnvAction envData = build.getAction(EnvAction.class);
    if (envData != null) {
      envData.add("TESTFLIGHT_INSTALL_URL", installUrl);
      envData.add("TESTFLIGHT_CONFIG_URL", configUrl);
    }
  }
  public GenericBeanDtoDescriptorBuilder() {

    this.properties = new LinkedList<IProperty>();

    final String label =
        Messages.getString("GenericBeanDtoDescriptorBuilder.column_n_short"); // $NON-NLS-1$
    final String labelLong =
        Messages.getString("GenericBeanDtoDescriptorBuilder.column_n_long"); // $NON-NLS-1$
    final String description =
        Messages.getString(
            "GenericBeanDtoDescriptorBuilder.description_of_column_n"); //$NON-NLS-1$

    final IPropertyBuilder propertyBuilder = CapCommonToolkit.propertyBuilder();
    propertyBuilder.setValueType(String.class).setSortable(true).setFilterable(true);
    final List<String> propertyNames = GenericBeanInitializer.ALL_PROPERTIES;
    for (int columnIndex = 0; columnIndex < propertyNames.size(); columnIndex++) {
      propertyBuilder.setName(propertyNames.get(columnIndex));
      propertyBuilder.setLabel(label.replace("%1", String.valueOf(columnIndex))); // $NON-NLS-1$
      propertyBuilder.setLabelLong(
          labelLong.replace("%1", String.valueOf(columnIndex))); // $NON-NLS-1$
      propertyBuilder.setDescription(
          description.replace("%1", String.valueOf(columnIndex))); // $NON-NLS-1$
      if (columnIndex < 80) {
        propertyBuilder.setReadonly(false);
      } else {
        propertyBuilder.setReadonly(true);
      }
      properties.add(propertyBuilder.build());
    }
  }
Exemplo n.º 14
0
  /** Initializes and constructs this panel. */
  private void init() {
    this.phoneNumberCombo.setEditable(true);

    this.callViaPanel.add(callViaLabel);
    this.callViaPanel.add(accountSelectorBox);

    this.comboPanel.add(phoneNumberCombo, BorderLayout.CENTER);

    this.callButton.setName("call");
    this.hangupButton.setName("hangup");
    this.minimizeButton.setName("minimize");
    this.restoreButton.setName("restore");

    this.minimizeButton.setToolTipText(
        Messages.getI18NString("hideCallPanel").getText() + " Ctrl - H");
    this.restoreButton.setToolTipText(
        Messages.getI18NString("showCallPanel").getText() + " Ctrl - H");

    this.callButton.addActionListener(this);
    this.hangupButton.addActionListener(this);
    this.minimizeButton.addActionListener(this);
    this.restoreButton.addActionListener(this);

    this.buttonsPanel.add(callButton);
    this.buttonsPanel.add(hangupButton);

    this.callButton.setEnabled(false);

    this.hangupButton.setEnabled(false);

    this.add(minimizeButtonPanel, BorderLayout.SOUTH);

    this.setCallPanelVisible(ConfigurationManager.isCallPanelShown());
  }
Exemplo n.º 15
0
 @Override
 public void addUser(
     CallingContext context,
     String userName,
     String description,
     String hashPassword,
     String email) {
   checkParameter("User", userName); // $NON-NLS-1$
   // Does the user already exist?
   RaptureUser usr = getUser(context, userName);
   if (usr == null) {
     usr = new RaptureUser();
     usr.setUsername(userName);
     usr.setDescription(description);
     usr.setHashPassword(hashPassword);
     usr.setEmailAddress(email);
     RaptureUserHelper.validateSalt(usr);
     usr.setInactive(false);
     RaptureUserStorage.add(
         usr, context.getUser(), Messages.getString("Admin.AddedUser") + userName); // $NON-NLS-1$
   } else {
     throw RaptureExceptionFactory.create(
         HttpURLConnection.HTTP_BAD_REQUEST,
         Messages.getString("Admin.UserAlreadyExists")); // $NON-NLS-1$
   }
 }
Exemplo n.º 16
0
  /**
   * Sanity checks the engine, no negative ratings, and similar checks.
   *
   * @return true if the engine is useable.
   */
  private boolean isValidEngine() {
    if (hasFlag(
        ~(CLAN_ENGINE | TANK_ENGINE | LARGE_ENGINE | SUPERHEAVY_ENGINE | SUPPORT_VEE_ENGINE))) {
      problem.append("Flags:" + engineFlags);
      return false;
    }

    if (hasFlag(SUPPORT_VEE_ENGINE)
        && (engineType != STEAM)
        && (engineType != COMBUSTION_ENGINE)
        && (engineType != BATTERY)
        && (engineType != FUEL_CELL)
        && (engineType != SOLAR)
        && (engineType != FISSION)
        && (engineType != NORMAL_ENGINE)
        && (engineType != NONE)) {
      problem.append("Invalid Engine type for support vehicle engines!");
      return false;
    }

    if ((((int) Math.ceil(engineRating / 5) > ENGINE_RATINGS.length) || (engineRating < 0))
        && !hasFlag(SUPPORT_VEE_ENGINE)) {
      problem.append("Rating:" + engineRating);
      return false;
    }
    if ((engineRating > 400) && !hasFlag(SUPPORT_VEE_ENGINE)) {
      engineFlags |= LARGE_ENGINE;
    }

    switch (engineType) {
      case COMBUSTION_ENGINE:
      case NORMAL_ENGINE:
      case XL_ENGINE:
      case XXL_ENGINE:
      case FUEL_CELL:
      case NONE:
      case MAGLEV:
      case BATTERY:
      case SOLAR:
        break;
      case COMPACT_ENGINE:
        if (hasFlag(LARGE_ENGINE)) {
          problem.append(Messages.getString("Engine.invalidCompactLarge"));
          return false;
        }
        break;
      case LIGHT_ENGINE:
      case FISSION:
        if (hasFlag(CLAN_ENGINE)) {
          problem.append(Messages.getString("Engine.invalidSphereOnly"));
          return false;
        }
        break;
      default:
        problem.append("Type:" + engineType);
        return false;
    }

    return true;
  }
Exemplo n.º 17
0
 /** Some type specific calls */
 @Override
 public void deleteUser(CallingContext context, String userName) {
   checkParameter("User", userName); // $NON-NLS-1$
   // Assuming the userName is not "you", mark the user as inactive
   if (userName.equals(context.getUser())) {
     throw RaptureExceptionFactory.create(
         HttpURLConnection.HTTP_BAD_REQUEST,
         Messages.getString("Admin.NoDeleteYourself")); // $NON-NLS-1$
   }
   log.info(Messages.getString("Admin.RemovingUser") + userName); // $NON-NLS-1$
   RaptureUser usr = getUser(context, userName);
   if (!usr.getInactive()) {
     if (usr.getHasRoot()) {
       throw RaptureExceptionFactory.create(
           HttpURLConnection.HTTP_BAD_REQUEST,
           Messages.getString("Admin.NoDeleteRoot")); // $NON-NLS-1$
     }
     usr.setInactive(true);
     RaptureUserStorage.add(
         usr,
         context.getUser(),
         Messages.getString("Admin.Made")
             + userName
             + Messages.getString("Admin.Inactive")); // $NON-NLS-1$ //$NON-NLS-2$
   }
 }
Exemplo n.º 18
0
  public void unregister(QName pid) throws BpelEngineException {
    if (__log.isTraceEnabled()) __log.trace("unregister: " + pid);

    try {
      ODEProcess p = _registeredProcesses.remove(pid);
      if (p == null) return;

      // TODO Looks like there are some possible bugs here, if a new version of a process gets
      // deployed, the service will be removed.
      p.deactivate();

      // Remove the process from any services that might reference it.
      // However, don't remove the service itself from the map.
      for (List<ODEProcess> processes : _serviceMap.values()) {
        __log.debug(
            "removing process " + pid + "; handle " + p + "; exists " + processes.contains(p));
        processes.remove(p);
      }

      __log.info(__msgs.msgProcessUnregistered(pid));

    } catch (Exception ex) {
      __log.error(__msgs.msgProcessUnregisterFailed(pid), ex);
      throw new BpelEngineException(ex);
    }
  }
Exemplo n.º 19
0
  private Parser createParser() {
    Parser result = new ClasspathToolParser("native2ascii", true); // $NON-NLS-1$
    result.setHeader(Messages.getString("Native2ASCII.Usage")); // $NON-NLS-1$

    result.add(
        new Option(
            "encoding",
            Messages.getString("Native2ASCII.EncodingHelp"),
            Messages.getString(
                "Native2ASCII.EncodingArgName")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        {
          public void parsed(String argument) throws OptionException {
            if (encoding != null)
              throw new OptionException(
                  Messages.getString("Native2ASCII.EncodingSpecified")); // $NON-NLS-1$
            encoding = argument;
          }
        });
    result.add(
        new Option(
            "reverse", Messages.getString("Native2ASCII.ReverseHelp")) // $NON-NLS-1$ //$NON-NLS-2$
        {
          public void parsed(String argument) throws OptionException {
            reversed = true;
          }
        });

    return result;
  }
Exemplo n.º 20
0
 public void init() {
   server = "localhost";
   port = "5432";
   database = Messages.getString("databasename", "realm");
   user = "******";
   password = Messages.getString("password", "realm");
 }
  @DataBoundConstructor
  public WwpassSecurityRealm(String certFile, String keyFile, String name, boolean allowsSignup) {

    this.disableSignup = !allowsSignup;

    this.name = name;

    if (certFile != null && !certFile.isEmpty() && keyFile != null && !keyFile.isEmpty()) {
      this.certFile = certFile;
      this.keyFile = keyFile;
    } else {
      if (System.getProperty("os.name").startsWith("Windows")) {
        this.certFile = DEFAULT_CERT_FILE_WINDOWS;
        this.keyFile = DEFAULT_KEY_FILE_WINDOWS;
      } else if (System.getProperty("os.name").startsWith("Linux")) {
        this.certFile = DEFAULT_CERT_FILE_LINUX;
        this.keyFile = DEFAULT_KEY_FILE_LINUX;
      } else {
        LOGGER.severe(Messages.WwpassSession_UnsupportedOsError());
        throw new Failure(Messages.WwpassSession_AuthError());
      }
    }

    if (!hasSomeUser()) {
      // if Hudson is newly set up with the security realm and there's no user account created yet,
      // insert a filter that asks the user to create one
      try {
        PluginServletFilter.addFilter(CREATE_FIRST_USER_FILTER);
      } catch (ServletException e) {
        throw new AssertionError(e); // never happen because our Filter.init is no-op
      }
    }
  }
Exemplo n.º 22
0
  public void decorate(Object element, IDecoration decoration) {
    if (!(element instanceof IResource)) return;
    IResource resource = (IResource) element;
    if (!resource.exists()) return;
    IProject project = resource.getProject();
    if (project == null) {
      Log.error(
          Messages.getString("ErrorDecorator.PROJECT_FOR")
              + resource.getName()
              + Messages.getString("ErrorDecorator.IS_NULL"),
          new Throwable()); //$NON-NLS-1$ //$NON-NLS-2$
      return;
    }
    try {
      if (!project.isOpen()) return;
      project.open(null);
      if (project.hasNature(LSLProjectNature.ID)) {
        LSLProjectNature nature = (LSLProjectNature) project.getNature(LSLProjectNature.ID);

        if (nature == null) return;

        IMarker[] m =
            resource.findMarkers("lslforge.problem", true, IResource.DEPTH_INFINITE); // $NON-NLS-1$

        if (m == null || m.length == 0) return;
      } else {
        return;
      }
    } catch (CoreException e) {
      Log.error("exception caught trying to determine project nature!", e); // $NON-NLS-1$
      return;
    }

    decoration.addOverlay(descriptor, IDecoration.BOTTOM_LEFT);
  }
Exemplo n.º 23
0
 @Override
 public void create() {
   super.create();
   setTitle(Messages.getString("RnFilterDialog.billsFilterCaption")); // $NON-NLS-1$
   setMessage(Messages.getString("RnFilterDialog.billsFilterMessage")); // $NON-NLS-1$
   getShell().setText(Messages.getString("RnFilterDialog.billsList")); // $NON-NLS-1$
 }
Exemplo n.º 24
0
  protected static final ObjectContainer openMemoryFile1(MemoryFile memoryFile) {
    synchronized (Db4o.lock) {
      if (memoryFile == null) {
        memoryFile = new MemoryFile();
      }
      ObjectContainer oc = null;
      if (Deploy.debug) {
        System.out.println("db4o Debug is ON");
        oc = new YapMemoryFile(memoryFile);

        // intentionally no exception handling,
        // in order to follow uncaught errors
      } else {
        try {
          oc = new YapMemoryFile(memoryFile);
        } catch (Throwable t) {
          Messages.logErr(i_config, 4, "Memory File", t);
          return null;
        }
      }
      if (oc != null) {
        Platform4.postOpen(oc);
        Messages.logMsg(i_config, 5, "Memory File");
      }
      return oc;
    }
  }
Exemplo n.º 25
0
    protected void buildPanel(String strPath) {
      BufferedReader reader = WFileUtil.openReadFile(strPath);
      String strLine;

      if (reader == null) return;

      try {
        while ((strLine = reader.readLine()) != null) {
          if (strLine.startsWith("#") || strLine.startsWith("%") || strLine.startsWith("@"))
            continue;

          StringTokenizer sTokLine = new StringTokenizer(strLine, ":");

          // first token is the label e.g. Password Length
          if (sTokLine.hasMoreTokens()) {
            createLabel(sTokLine.nextToken(), this);
          }

          // second token is the value
          String strValue = sTokLine.hasMoreTokens() ? sTokLine.nextToken() : "";
          if (strValue.equalsIgnoreCase("yes") || strValue.equalsIgnoreCase("no"))
            createChkBox(strValue, this);
          else createTxf(strValue, this);
        }
      } catch (Exception e) {
        Messages.writeStackTrace(e);
        // e.printStackTrace();
        Messages.postDebug(e.toString());
      }
    }
Exemplo n.º 26
0
  private void getTableName() {
    DatabaseMeta inf = null;
    // New class: SelectTableDialog
    int connr = wConnection.getSelectionIndex();
    if (connr >= 0) inf = transMeta.getDatabase(connr);

    if (inf != null) {
      log.logDebug(
          toString(),
          Messages.getString("UpdateDialog.Log.LookingAtConnection")
              + inf.toString()); // $NON-NLS-1$

      DatabaseExplorerDialog std =
          new DatabaseExplorerDialog(shell, SWT.NONE, inf, transMeta.getDatabases());
      std.setSelectedSchema(wSchema.getText());
      std.setSelectedTable(wTable.getText());
      std.setSplitSchemaAndTable(true);
      if (std.open() != null) {
        wSchema.setText(Const.NVL(std.getSchemaName(), ""));
        wTable.setText(Const.NVL(std.getTableName(), ""));
      }
    } else {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setMessage(
          Messages.getString("UpdateDialog.InvalidConnection.DialogMessage")); // $NON-NLS-1$
      mb.setText(Messages.getString("UpdateDialog.InvalidConnection.DialogTitle")); // $NON-NLS-1$
      mb.open();
    }
  }
 /** Method edit employee on database and edit on employee table */
 private void editEmp() {
   parent.doBlur();
   // Get Id employee selected
   String empID = view.getTblEmp().getValueAt(view.getTblEmp().getSelectedRow(), 0).toString();
   // Get employee from database
   Employee emp = AccessEmp.getInstance().getEmpInfo(new Integer(empID));
   // Create instance of Employee edit dialog and display it
   editEmp = new EditEmployeeController(new EditEmployeeDialog(parent.getView()), emp);
   editEmp.getView().setVisible(true);
   // Update data on database
   if (editEmp.getEmp() != null) {
     if (AccessEmp.getInstance().editEmp(editEmp.getEmp())) {
       JOptionPane.showMessageDialog(
           view,
           Messages.getString("EmployeeController.14"), // $NON-NLS-1$
           Messages.getString("EmployeeController.15"),
           JOptionPane.INFORMATION_MESSAGE);
       // Remove old data on table model
       empModel.removeRow(view.getTblEmp().getSelectedRow());
       // Add new row
       empModel.addRow(emp.toVector());
     } else {
       JOptionPane.showMessageDialog(
           view,
           Messages.getString("EmployeeController.16") // $NON-NLS-1$
               + Messages.getString("EmployeeController.17"),
           Messages.getString("EmployeeController.18"), // $NON-NLS-1$
           JOptionPane.ERROR_MESSAGE);
     }
   }
   parent.doBlur();
   // Set selection to employee book
   view.getTblEmp().changeSelection(view.getTblEmp().getRowCount() - 1, 0, false, false);
 }
    public void actionPerformed(final ActionEvent e) {
      final KettleQueryEntry kettleQueryEntry = (KettleQueryEntry) queryNameList.getSelectedValue();
      final KettleTransFromFileProducer fileProducer = kettleQueryEntry.createProducer();
      final KettleDataFactory dataFactory = new KettleDataFactory();
      dataFactory.setQuery(kettleQueryEntry.getName(), fileProducer);

      try {
        DataFactoryEditorSupport.configureDataFactoryForPreview(dataFactory, designTimeContext);

        final DataPreviewDialog previewDialog = new DataPreviewDialog(KettleDataSourceDialog.this);

        final KettlePreviewWorker worker =
            new KettlePreviewWorker(dataFactory, kettleQueryEntry.getName());
        previewDialog.showData(worker);

        final ReportDataFactoryException factoryException = worker.getException();
        if (factoryException != null) {
          ExceptionDialog.showExceptionDialog(
              KettleDataSourceDialog.this,
              Messages.getString("KettleDataSourceDialog.PreviewError.Title"),
              Messages.getString("KettleDataSourceDialog.PreviewError.Message"),
              factoryException);
        }
      } catch (Exception ex) {
        ExceptionDialog.showExceptionDialog(
            KettleDataSourceDialog.this,
            Messages.getString("KettleDataSourceDialog.PreviewError.Title"),
            Messages.getString("KettleDataSourceDialog.PreviewError.Message"),
            ex);
      }
    }
Exemplo n.º 29
0
 @Test
 public void Messageインスタンスを追加できる() {
   Messages msgs = new Messages(MessageType.ERROR);
   msgs.add(new Message("CREATE_MESSAGE_TEST#001"));
   List<String> messegeList = msgs.getMessageList();
   assertThat(messegeList, hasItem("これはメッセージ生成のテストです。"));
 }
Exemplo n.º 30
0
  /**
   * Test batched prepared statement concurrency. Batch prepares must not disappear between the
   * moment when they were created and when they are executed.
   */
  public void testConcurrentBatching() throws Exception {
    // Create a connection with a batch size of 1. This should cause prepares and actual batch
    // execution to become
    // interspersed (if correct synchronization is not in place) and greatly increase the chance of
    // prepares
    // being rolled back before getting executed.
    Properties props = new Properties();
    props.setProperty(Messages.get(net.sourceforge.jtds.jdbc.Driver.BATCHSIZE), "1");
    props.setProperty(
        Messages.get(net.sourceforge.jtds.jdbc.Driver.PREPARESQL),
        String.valueOf(TdsCore.TEMPORARY_STORED_PROCEDURES));
    Connection con = getConnection(props);

    try {
      Statement stmt = con.createStatement();
      stmt.execute(
          "create table #testConcurrentBatch (v1 int, v2 int, v3 int, v4 int, v5 int, v6 int)");
      stmt.close();

      Vector exceptions = new Vector();
      con.setAutoCommit(false);

      Thread t1 = new ConcurrentBatchingHelper(con, exceptions);
      Thread t2 = new ConcurrentBatchingHelper(con, exceptions);
      t1.start();
      t2.start();
      t1.join();
      t2.join();

      assertEquals(0, exceptions.size());
    } finally {
      con.close();
    }
  }