Examples of InputFile


Examples of com.icesoft.faces.component.inputfile.InputFile

  /**
   * Used for reading a Certificate Signing Request file upload into the certificate request String.
   * @param actionEvent is the parameter from the web framework containing the file.
   */
  public void uploadActionListener(ActionEvent actionEvent) {
        InputFile inputFile = (InputFile) actionEvent.getSource();
    FacesContext context = FacesContext.getCurrentInstance();
        if (inputFile.getFileInfo().isSaved()) {
          // Validate that it is a CSR..
          File f = inputFile.getFileInfo().getFile();
            // Assume this is a small file.. it should be..
            long len = f.length();
            if (len < 16*1024L) {
                byte[] buf = new byte[(int) len];
                try {
                    FileInputStream in = new FileInputStream(f);
                    in.read(buf);
                    in.close();
                } catch (IOException e) {
                  context.addMessage(null /*actionEvent.getComponent().getClientId(context)*/, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.csrcert.uploadfailed"), null));
                  log.debug("Rejected uploaded file due to IOException.");
                  return;
        }
                try {
                    // See if it was a PEM
                  buf = FileTools.getBytesFromPEM(buf, PEM_CSR_BEGIN, PEM_CSR_END);
                } catch (IOException e) {
                  log.debug("Uploaded file was not a PEM.. tryin to parse it as a DER encoded request.");
                }
                // See if it as a PKCS10
                try {
                    new PKCS10CertificationRequest(buf);
                } catch (Exception e) {
                  context.addMessage(null /*actionEvent.getComponent().getClientId(context)*/, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.csrcert.uploadfailednotpkcs10"), null));
                  log.debug("Rejected uploaded file since it's not a valid PKCS#10 request.");
                  return;
                }
              // Convert it back to a PEM
                String pem = PEM_CSR_BEGIN + "\n" + new String(Base64.encode(buf)) + "\n" + PEM_CSR_END;
                certificateRequest = pem;
              context.addMessage(null /*actionEvent.getComponent().getClientId(context)*/, new FacesMessage(FacesMessage.SEVERITY_INFO, getMessage("enroll.csrcert.uploadok"), null));
            } else {
              context.addMessage(null /*actionEvent.getComponent().getClientId(context)*/, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.csrcert.uploadfailedtoolarge"), null));
            }
        } else {
          log.debug("File upload failed: " + inputFile.getFileInfo().getException().getMessage());
        context.addMessage(null /*actionEvent.getComponent().getClientId(context)*/, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.csrcert.uploadfailed"), null));
        }
  }
View Full Code Here

Examples of com.icesoft.faces.component.inputfile.InputFile

  public void uploadFile(ActionEvent event) {
    try {
      articoloDaRicerca = false;
      articoloDaSchedaConto = false;
      resettaMappaListaRighePartite();
      InputFile inputFile = (InputFile) event.getSource();
      CaricamentoDi caricamentoDi = inputFileController.uploadFile(inputFile);
      movimentiCaricati = (List<MovimentoContabile>) caricamentoDi.leggiFile();
      controllaCoerenzaDatiArticolo(movimentiCaricati);
      importaMovimenti(movimentiCaricati);
      impostaMovimentiImportati(movimentiCaricati);
View Full Code Here

Examples of com.liferay.faces.alloy.component.inputfile.InputFile

    Assert.assertTrue(ajaxParameters.getRender().equals(StringPool.BLANK));
  }

  protected AjaxParameters newAjaxParameters(String clientId, String formClientId, String execute, String render) {

    InputFile inputFile = new InputFileMockImpl(execute, render);

    return new AjaxParameters(inputFile, clientId, formClientId);
  }
View Full Code Here

Examples of com.liferay.faces.bridge.component.inputfile.InputFile

    super.startElement(name, uiComponent);

    if (StringPool.INPUT.equals(name)) {

      InputFile inputFile = (InputFile) uiComponent;

      String multiple = inputFile.getMultiple();

      if ("multiple".equalsIgnoreCase(multiple)) {
        super.writeAttribute("multiple", multiple, "multiple");
      }
    }
View Full Code Here

Examples of de.maramuse.soundcomp.files.InputFile

  private Event getSnare(double left, double right) {
  // create the snare drum from a sampled file
  Event snare=new Event();
  mul m3=new mul(), m4=new mul();
  InputFile ifsn=new InputFile("javasrc/de/maramuse/soundcomp/test/testfiles/sd.wav");
  snare.setAbstractName("snare");
  snare.setInstanceName("snare"+nameCount++);
  snare.setDuration(0.025);
  snare.setLivetime(1.25);
  snare.addElement(ifsn);
View Full Code Here

Examples of de.maramuse.soundcomp.files.InputFile

  private Event getCrash(double left, double right) {
  // create the crash cymbal
  // TODO a crash cymbal, when hit multiple times, does not create overlaying sounds, the older sound
  // would need to be stopped similar to the hihat handling
  Event crash=new Event();
  InputFile ifsn=new InputFile("javasrc/de/maramuse/soundcomp/test/testfiles/crash.wav");
  crash.setDuration(0.025);
  crash.setLivetime(5.25);
  crash.addElement(ifsn);
  crash.setAbstractName("crash");
  crash.setInstanceName("crash"+nameCount++);
View Full Code Here

Examples of de.maramuse.soundcomp.files.InputFile

  // create the ride cymbal
  // TODO a ride cymbal is played in multiple, clearly distinct ways
  // TODO a ride cymbal, when hit multiple times, does not create simple overlaying sounds, the older sound
  // would need to be influenced on a second hit depending on what kind of hit occurs
  Event ride=new Event();
  InputFile ifsn=new InputFile("javasrc/de/maramuse/soundcomp/test/testfiles/ride.wav");
  ride.setDuration(0.025);
  ride.setLivetime(5.25);
  ride.addElement(ifsn);
  ride.setAbstractName("ride");
  ride.setInstanceName("ride"+nameCount++);
View Full Code Here

Examples of de.maramuse.soundcomp.files.InputFile

  private Event getHHOpen(double left, double right) {
  // create the open hihat from a sampled file
  synchronized(hihatsync){
    Event hihat_open=new Event();
    InputFile ifho=new InputFile("javasrc/de/maramuse/soundcomp/test/testfiles/hh-o.wav");
    hihat_open.setDuration(0.025);
    hihat_open.setLivetime(1.25);
    hihat_open.addElement(ifho);
    /*
     * we would have to disregister the open hihat when it is hit closed, but not at creation time, rather at run
View Full Code Here

Examples of de.maramuse.soundcomp.files.InputFile

  private Event getHHClosed(double left, double right) {
  // create the closed hihat from a sampled file
  synchronized(hihatsync){
    Event hihat_closed=new Event();
    mul m3=new mul(), m4=new mul();
    InputFile ifhc=new InputFile("javasrc/de/maramuse/soundcomp/test/testfiles/hh-c.wav");
    ifhc.setAbstractName("ifhc");
    ifhc.setInstanceName("ifhc"+nameCount++);
    hihat_closed.setDuration(0.025);
    hihat_closed.setLivetime(0.5);
    /*
     * we would have to disregister the open hihat when it is hit closed, but not at creation time, rather at run
     * time. if(hihat!=null){ hihat.die(); drums_L.disconnect(hihatcl); drums_R.disconnect(hihatcr); }
View Full Code Here

Examples of de.maramuse.soundcomp.files.InputFile

  private Event getSnare(double left, double right) {
  // create the snare drum from a sampled file
  Event snare=new Event();
  mul m3=new mul(), m4=new mul();
  InputFile ifsn=new InputFile("javasrc/de/maramuse/soundcomp/test/testfiles/sd.wav");
  snare.setAbstractName("snare");
  snare.setInstanceName("snare"+nameCount++);
  snare.setDuration(0.025);
  snare.setLivetime(1.25);
  snare.addElement(ifsn);
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.