Exemple #1
0
 public static Vector expandFileList(String[] files, boolean inclDirs) {
   Vector v = new Vector();
   if (files == null) return v;
   for (int i = 0; i < files.length; i++) v.add(new File(URLDecoder.decode(files[i])));
   for (int i = 0; i < v.size(); i++) {
     File f = (File) v.get(i);
     if (f.isDirectory()) {
       File[] fs = f.listFiles();
       for (int n = 0; n < fs.length; n++) v.add(fs[n]);
       if (!inclDirs) {
         v.remove(i);
         i--;
       }
     }
   }
   return v;
 }
 public CachedProbe(AffyProbe ap, Vector<AffyExperiment> expts) {
   probe = ap;
   min = max = 0.0;
   color = Color.lightGray;
   stroke = new BasicStroke((float) 2.0);
   values = new Vector<Double>();
   for (AffyExperiment e : expts) {
     AffyMeasurement am = e.getMeasurement(probe);
     if (am != null) {
       values.add(am.getValue());
       min = Math.min(am.getValue(), min);
       max = Math.max(am.getValue(), max);
     } else {
       values.add(null);
     }
   }
 }
 public static Vector testInstancesWithBindingAndNoCalendarPrinting() {
   Vector tests = new Vector(calendarStrings.length);
   for (int i = 0; i < calendarStrings.length; i++) {
     tests.add(
         new CalendarToTSTZWithBindingTest(
             i + (calendarStrings.length + 1), calendarStrings[i], false));
   }
   return tests;
 }
 /* Non-recursive (NR) version of Node.getElementsByTagName(...)
  */
 static Element[] getElementsByTagNameNR(Element e, String tagName) {
   Vector<Element> elements = new Vector<Element>();
   Node child = e.getFirstChild();
   while (child != null) {
     if (child instanceof Element && child.getNodeName().equals(tagName)) {
       elements.add((Element) child);
     }
     child = child.getNextSibling();
   }
   Element[] result = new Element[elements.size()];
   elements.copyInto(result);
   return result;
 }
  // @karen not completed
  public Vector getRecord_Sorted(String sSQL, int type) {
    Vector v = new Vector();
    Connection con = null;
    Statement st = null;
    ResultSet rs = null;

    try {

      // int SortType = getSortType();
      sSQL = sSQL + " ORDER BY ";

      if (type == 1) {
        if (SortType == 1) sSQL = sSQL + "CompanyName";
        else if (SortType == 2) sSQL = sSQL + "CompanyDesc";

        if (Toggle[SortType - 1] == 1) sSQL = sSQL + " DESC";
      } else {
        if (SortType_org == 1) sSQL = sSQL + "OrganizationName";
        else if (SortType_org == 2) sSQL = sSQL + "OrganizationCode";
        else if (SortType_org == 3) sSQL = sSQL + "NameSequence";

        if (Toggle_org[SortType_org - 1] == 1) sSQL = sSQL + " DESC";
      }

      con = ConnectionBean.getConnection();
      st = con.createStatement();
      rs = st.executeQuery(sSQL);

      while (rs.next()) {
        votblConsultingCompany vo = new votblConsultingCompany();
        vo.setCompanyDesc(rs.getString("CompanyDesc"));
        vo.setCompanyName(rs.getString("CompanyName"));
        vo.setCompanyID(rs.getInt("CompanyID"));
        v.add(vo);
      }

    } catch (SQLException SE) {
      System.err.println("Organization.java - getRecord_Sorted - " + SE.getMessage());
    } finally {

      ConnectionBean.closeRset(rs); // Close ResultSet
      ConnectionBean.closeStmt(st); // Close statement
      ConnectionBean.close(con); // Close connection
    }

    return v;
  }
Exemple #6
0
  protected static double[] parseGapScalingFactorMultipliersString(
      String gapScalingFactorMultipliersString) {
    StringTokenizer tok =
        new StringTokenizer(gapScalingFactorMultipliersString, GSFM_PARAMETER_DELIMITER);
    Vector<Double> vec = new Vector<Double>();
    while (tok.hasMoreTokens()) {
      Double gsfm = new Double(Double.parseDouble(tok.nextToken()));
      vec.add(gsfm);
    }

    double[] result = new double[vec.size()];
    for (int i = 0; i < result.length; i++) {
      result[i] = ((Double) (vec.get(i))).doubleValue();
    }

    return (result);
  }
 /** Update a message */
 public void updateData(SOAPMonitorData soap) {
   int row;
   if (filter_data == null) {
     // No filter, so just fire table updated
     row = data.indexOf(soap);
     if (row != -1) {
       fireTableRowsUpdated(row, row);
     }
   } else {
     // Check if the row was being displayed
     row = filter_data.indexOf(soap);
     if (row == -1) {
       // Row was not displayed, so check for if it
       // now needs to be displayed
       if (filterMatch(soap)) {
         int index = -1;
         row = data.indexOf(soap) + 1;
         while ((row < data.size()) && (index == -1)) {
           index = filter_data.indexOf(data.elementAt(row));
           if (index != -1) {
             // Insert at this location
             filter_data.add(index, soap);
           }
           row++;
         }
         if (index == -1) {
           // Insert at end
           index = filter_data.size();
           filter_data.addElement(soap);
         }
         fireTableRowsInserted(index, index);
       }
     } else {
       // Row was displayed, so check if it needs to
       // be updated or removed
       if (filterMatch(soap)) {
         fireTableRowsUpdated(row, row);
       } else {
         filter_data.remove(soap);
         fireTableRowsDeleted(row, row);
       }
     }
   }
 }
Exemple #8
0
  /**
   * Returns MediaDescription object with the specified properties. The returned object will respond
   * to Media.getMediaFormats(boolean) with a Vector of String objects specified by the 'formats
   * argument.
   *
   * @param media the media type, eg "audio"
   * @param port port number on which to receive media
   * @param numPorts number of ports used for this media stream
   * @param transport transport type, eg "RTP/AVP"
   * @param formats list of formats which should be specified by the returned MediaDescription
   * @return MediaDescription
   */
  public MediaDescription createMediaDescription(
      String media, int port, int numPorts, String transport, String[] formats) {
    MediaDescriptionImpl mediaDescriptionImpl = new MediaDescriptionImpl();
    try {

      MediaField mediaImpl = new MediaField();
      mediaImpl.setMediaType(media);
      mediaImpl.setMediaPort(port);
      mediaImpl.setPortCount(numPorts);
      mediaImpl.setProtocol(transport);

      Vector formatsV = new Vector(formats.length);
      for (int i = 0; i < formats.length; i++) formatsV.add(formats[i]);
      mediaImpl.setMediaFormats(formatsV);
      mediaDescriptionImpl.setMedia(mediaImpl);
    } catch (SdpException s) {
      s.printStackTrace();
    }
    return mediaDescriptionImpl;
  }
  public Vector getAllOrganizations(int iFKCompanyID) {
    Vector v = new Vector();
    Connection con = null;
    Statement st = null;
    ResultSet rs = null;

    /*
     * Change(s) : Changed the SQL statement to get the company name as well
     * Reason(s) : Able to set the selected company name when company selection is changed in OrganizationList.jsp
     * Updated By: Gwen Oh
     * Updated On: 26 Sep 2011
     */
    // String sSQL="SELECT * FROM tblOrganization WHERE FKCompanyID= "+ iFKCompanyID;
    String sSQL =
        "SELECT tblOrganization.*, tblConsultingCompany.CompanyName FROM "
            + "tblOrganization INNER JOIN tblConsultingCompany ON tblOrganization.FKCompanyID = tblConsultingCompany.CompanyID "
            + "WHERE tblOrganization.FKCompanyID="
            + iFKCompanyID;
    try {
      /*
       * Re-edited by Eric Lu 15-May-08
       *
       * Added sort and toggle functionality for getting organizations
       */
      sSQL = sSQL + " ORDER BY ";

      if (SortType_org == 1) sSQL = sSQL + "OrganizationName";
      else if (SortType_org == 2) sSQL = sSQL + "OrganizationCode";
      else if (SortType_org == 3) sSQL = sSQL + "NameSequence";

      if (Toggle_org[SortType_org - 1] == 1) sSQL = sSQL + " DESC";

      con = ConnectionBean.getConnection();
      st = con.createStatement();
      rs = st.executeQuery(sSQL);

      while (rs.next()) {
        votblOrganization vo = new votblOrganization();
        vo.setEmailNom(rs.getString("EmailNom"));
        vo.setEmailNomRemind(rs.getString("EmailNomRemind"));
        vo.setEmailPart(rs.getString("EmailPart"));
        vo.setEmailPartRemind(rs.getString("EmailPartRemind"));
        vo.setExtraModule(rs.getInt("ExtraModule"));
        vo.setFKCompanyID(rs.getInt("FKCompanyID"));
        vo.setNameSequence(rs.getInt("NameSequence"));
        vo.setOrganizationCode(rs.getString("OrganizationCode"));
        vo.setOrganizationLogo(rs.getString("OrganizationLogo"));
        vo.setOrganizationName(rs.getString("OrganizationName"));
        vo.setPKOrganization(rs.getInt("PKOrganization"));
        // Gwen Oh - 26/09/2011: Set the company name
        vo.setCompanyName(rs.getString("CompanyName"));

        v.add(vo);
      }

    } catch (SQLException SE) {
      System.err.println("Organization.java - getAllOrganizations - " + SE.getMessage());
    } finally {

      ConnectionBean.closeRset(rs); // Close ResultSet
      ConnectionBean.closeStmt(st); // Close statement
      ConnectionBean.close(con); // Close connection
    }

    return v;
  }
Exemple #10
0
  public static void main(String[] args) {
    if (args.length != 2) {
      System.out.println(
          "Usage: java Purger <folder> <date>\n"
              + " - folder: is the path to account.txt and athena.txt files.\n"
              + " - date: accounts created before this date will be purged (dd/mm/yy or yyyy-mm-dd).");
      return;
    }

    int accounts = 0;
    int characters = 0;
    int deletedCharacters = 0;
    Vector activeAccounts = new Vector();

    File folder = new File(args[0]);
    // Do some sanity checking
    if (!folder.exists()) {
      System.out.println("Folder does not exist!");
      return;
    }
    if (!folder.isDirectory()) {
      System.out.println("Folder is not a folder!");
      return;
    }

    File oldAccount = new File(folder, "account.txt");
    File oldAthena = new File(folder, "athena.txt");
    File newAccount = new File(folder, "account.txt.new");
    File newAthena = new File(folder, "athena.txt.new");

    DateFormat dateFormat;
    Date purgeDate = null;

    for (String format : new String[] {"dd/MM/yy", "yyyy-MM-dd"}) {
      dateFormat = new SimpleDateFormat(format);

      try {
        purgeDate = dateFormat.parse(args[1]);
        break;
      } catch (ParseException e) {
      }
    }

    if (purgeDate == null) {
      System.out.println("ERROR: Date format not recognized.");
      return;
    }

    String line;

    // Remove accounts
    try {
      FileInputStream fin = new FileInputStream(oldAccount);
      BufferedReader input = new BufferedReader(new InputStreamReader(fin));
      FileOutputStream fout = new FileOutputStream(newAccount);
      PrintStream output = new PrintStream(fout);

      while ((line = input.readLine()) != null) {
        boolean copy = false;
        String[] fields = line.split("\t");
        // Check if we're reading a comment or the last line
        if (line.substring(0, 2).equals("//") || fields[1].charAt(0) == '%') {
          copy = true;
        } else {
          // Server accounts should not be purged
          if (!fields[4].equals("S")) {
            accounts++;
            dateFormat = new SimpleDateFormat("yyyy-MM-dd");
            try {
              Date date = dateFormat.parse(fields[3]);
              if (date.after(purgeDate)) {
                activeAccounts.add(fields[0]);
                copy = true;
              }
            } catch (ParseException e) {
              System.out.println(
                  "ERROR: Wrong date format in account.txt. (" + accounts + ": " + line + ")");
              // return;
            } catch (Exception e) {
              e.printStackTrace();
              return;
            }
          } else {
            copy = true;
          }
        }
        if (copy) {
          try {
            output.println(line);
          } catch (Exception e) {
            System.err.println("ERROR: Unable to write file.");
          }
        }
      }
      input.close();
      output.close();
    } catch (FileNotFoundException e) {
      System.out.println("ERROR: file " + oldAccount.getAbsolutePath() + " not found.");
      return;
    } catch (Exception e) {
      System.out.println("ERROR: unable to process account.txt");
      e.printStackTrace();
      return;
    }

    System.out.println(
        "Removed " + (accounts - activeAccounts.size()) + "/" + accounts + " accounts.");

    // Remove characters
    try {
      FileInputStream fin = new FileInputStream(oldAthena);
      BufferedReader input = new BufferedReader(new InputStreamReader(fin));
      FileOutputStream fout = new FileOutputStream(newAthena);
      PrintStream output = new PrintStream(fout);

      while ((line = input.readLine()) != null) {
        boolean copy = false;
        String[] fields = line.split("\t");
        // Check if we're reading a comment or the last line
        if (line.substring(0, 2).equals("//") || fields[1].charAt(0) == '%') {
          copy = true;
        } else {
          characters++;
          String id = fields[1].substring(0, fields[1].indexOf(','));
          if (activeAccounts.contains(id)) {
            copy = true;
          } else {
            deletedCharacters++;
          }
        }
        if (copy) {
          output.println(line);
        }
      }
      input.close();
      output.close();
    } catch (FileNotFoundException e) {
      System.out.println("ERROR: file " + oldAthena.getAbsolutePath() + " not found.");
      return;
    } catch (Exception e) {
      System.out.println("ERROR: unable to process athena.txt");
      e.printStackTrace();
      return;
    }

    System.out.println("Removed " + deletedCharacters + "/" + characters + " characters.");
  }
Exemple #11
0
  /**
   * Handles the <tt>ActionEvent</tt> generated when user presses one of the buttons in this panel.
   */
  public void actionPerformed(ActionEvent evt) {
    JButton button = (JButton) evt.getSource();
    String buttonName = button.getName();

    if (buttonName.equals("call")) {
      Component selectedPanel = mainFrame.getSelectedTab();

      // call button is pressed over an already open call panel
      if (selectedPanel != null
          && selectedPanel instanceof CallPanel
          && ((CallPanel) selectedPanel).getCall().getCallState()
              == CallState.CALL_INITIALIZATION) {

        NotificationManager.stopSound(NotificationManager.BUSY_CALL);
        NotificationManager.stopSound(NotificationManager.INCOMING_CALL);

        CallPanel callPanel = (CallPanel) selectedPanel;

        Iterator participantPanels = callPanel.getParticipantsPanels();

        while (participantPanels.hasNext()) {
          CallParticipantPanel panel = (CallParticipantPanel) participantPanels.next();

          panel.setState("Connecting");
        }

        Call call = callPanel.getCall();

        answerCall(call);
      }
      // call button is pressed over the call list
      else if (selectedPanel != null
          && selectedPanel instanceof CallListPanel
          && ((CallListPanel) selectedPanel).getCallList().getSelectedIndex() != -1) {

        CallListPanel callListPanel = (CallListPanel) selectedPanel;

        GuiCallParticipantRecord callRecord =
            (GuiCallParticipantRecord) callListPanel.getCallList().getSelectedValue();

        String stringContact = callRecord.getParticipantName();

        createCall(stringContact);
      }
      // call button is pressed over the contact list
      else if (selectedPanel != null && selectedPanel instanceof ContactListPanel) {
        // call button is pressed when a meta contact is selected
        if (isCallMetaContact) {
          Object[] selectedContacts =
              mainFrame.getContactListPanel().getContactList().getSelectedValues();

          Vector telephonyContacts = new Vector();

          for (int i = 0; i < selectedContacts.length; i++) {

            Object o = selectedContacts[i];

            if (o instanceof MetaContact) {

              Contact contact =
                  ((MetaContact) o).getDefaultContact(OperationSetBasicTelephony.class);

              if (contact != null) telephonyContacts.add(contact);
              else {
                new ErrorDialog(
                        this.mainFrame,
                        Messages.getI18NString("warning").getText(),
                        Messages.getI18NString(
                                "contactNotSupportingTelephony",
                                new String[] {((MetaContact) o).getDisplayName()})
                            .getText())
                    .showDialog();
              }
            }
          }

          if (telephonyContacts.size() > 0) createCall(telephonyContacts);

        } else if (!phoneNumberCombo.isComboFieldEmpty()) {

          // if no contact is selected checks if the user has chosen
          // or has
          // writen something in the phone combo box

          String stringContact = phoneNumberCombo.getEditor().getItem().toString();

          createCall(stringContact);
        }
      } else if (selectedPanel != null && selectedPanel instanceof DialPanel) {
        String stringContact = phoneNumberCombo.getEditor().getItem().toString();
        createCall(stringContact);
      }
    } else if (buttonName.equalsIgnoreCase("hangup")) {
      Component selectedPanel = this.mainFrame.getSelectedTab();

      if (selectedPanel != null && selectedPanel instanceof CallPanel) {

        NotificationManager.stopSound(NotificationManager.BUSY_CALL);
        NotificationManager.stopSound(NotificationManager.INCOMING_CALL);
        NotificationManager.stopSound(NotificationManager.OUTGOING_CALL);

        CallPanel callPanel = (CallPanel) selectedPanel;

        Call call = callPanel.getCall();

        if (removeCallTimers.containsKey(callPanel)) {
          ((Timer) removeCallTimers.get(callPanel)).stop();
          removeCallTimers.remove(callPanel);
        }

        removeCallPanel(callPanel);

        if (call != null) {
          ProtocolProviderService pps = call.getProtocolProvider();

          OperationSetBasicTelephony telephony = mainFrame.getTelephonyOpSet(pps);

          Iterator participants = call.getCallParticipants();

          while (participants.hasNext()) {
            try {
              // now we hang up the first call participant in the
              // call
              telephony.hangupCallParticipant((CallParticipant) participants.next());
            } catch (OperationFailedException e) {
              logger.error("Hang up was not successful: " + e);
            }
          }
        }
      }
    } else if (buttonName.equalsIgnoreCase("minimize")) {
      JCheckBoxMenuItem hideCallPanelItem =
          mainFrame.getMainMenu().getViewMenu().getHideCallPanelItem();

      if (!hideCallPanelItem.isSelected()) hideCallPanelItem.setSelected(true);

      this.setCallPanelVisible(false);
    } else if (buttonName.equalsIgnoreCase("restore")) {

      JCheckBoxMenuItem hideCallPanelItem =
          mainFrame.getMainMenu().getViewMenu().getHideCallPanelItem();

      if (hideCallPanelItem.isSelected()) hideCallPanelItem.setSelected(false);

      this.setCallPanelVisible(true);
    }
  }
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    javax.servlet.jsp.PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html;charset=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n\r\n");
      out.write("\r\n\r\n");

      String strIp = (String) request.getParameter("ip");
      String strCommunityString = (String) request.getParameter("cs");
      String strPort = (String) request.getParameter("port");
      String strTimeout = (String) request.getParameter("timeout");
      String strRetries = (String) request.getParameter("retries");
      String strNodeLabel = (String) request.getParameter("node");
      String strNodeId = request.getParameter("nodeId");
      String strFirstTime = (String) request.getParameter("firsttime");
      String strWindowId = (String) request.getParameter("windowid");

      // Create the querier and make the request.
      QueryFactory factory = new QueryFactory();
      Querier querier = (Querier) factory.createQuerier(WinPagePerfSnmpQuerier.QUERIER_NAME);
      DeviceCommunicator deviceCommunicator = new DeviceCommunicator();
      deviceCommunicator.sendQuery(querier, strIp);

      // Error processing
      if (querier.getErrorStatus() == -1) {
        RequestDispatcher rd =
            getServletContext()
                .getRequestDispatcher("/jsp/WTerror-handler.jsp?error=SnmpCommError");
        rd.forward(request, response);
        return;
      }
      if (querier.getErrorStatus() == -2) {
        RequestDispatcher rd =
            getServletContext()
                .getRequestDispatcher("/jsp/WTerror-handler.jsp?error=NoPerfmibSnmpError");
        rd.forward(request, response);
        return;
      }

      if (querier.getErrorStatus() != 0) {
        RequestDispatcher rd =
            getServletContext().getRequestDispatcher("/jsp/WTerror-handler.jsp?error=SnmpError");
        rd.forward(request, response);
        return;
      }

      Map calcs = querier.getCalculations();
      long[] results = (long[]) calcs.get(WinPagePerfSnmpQuerier.PAGE_RESULTS);

      if (results[0] < 0
          || results[1] < 0
          || results[2] < 0
          || results[3] < 0
          || results[4] < 0
          || results[5] < 0
          || results[6] < 0
          || results[7] < 0
          || results[8] < 0
          || results[9] < 0) {
        RequestDispatcher rd =
            getServletContext().getRequestDispatcher("/jsp/WTerror-handler.jsp?error=SnmpError");
        rd.forward(request, response);
        return;
      }

      Vector vPageStats = null;

      if (strFirstTime == null) {
        // Not the first time, so get the previous polled data from the session
        vPageStats = (Vector) session.getAttribute("vPageStats" + strWindowId);
      } else {
        // This is the first time in this JSP, so create the Vector which will contain the
        // polled data
        Random random = new Random();
        strWindowId = String.valueOf(random.nextInt());

        vPageStats = new Vector();
      }

      vPageStats.add(results);
      session.setAttribute("vPageStats" + strWindowId, vPageStats);

      // This random number is used to prevent the brower from caching the IMG tags
      Random random = new Random();
      int randomInt = random.nextInt();

      out.write("\r\n\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n  ");
      out.write("<title>WebTelemetry - Graphs | Real-Time | Windows Page Performance Monitoring");
      out.write("</title>\r\n  ");
      out.write("<META HTTP-EQUIV=\"refresh\" CONTENT=\"");
      out.print(WTProperties.getMonitorUIRefreshRate());
      out.write("; URL=");
      out.print(WTTools.getJspURL(request));
      out.write("WTwin-page-monitor.jsp?cs=");
      out.print(URLEncoder.encode(strCommunityString, "UTF-8"));
      out.write("&ip=");
      out.print(strIp);
      out.write("&port=");
      out.print(strPort);
      out.write("&timeout=");
      out.print(strTimeout);
      out.write("&retries=");
      out.print(strRetries);
      out.write("&node=");
      out.print(URLEncoder.encode(strNodeLabel, "UTF-8"));
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("&nodeId=");
      out.print(strNodeId);
      out.write("\">\r\n  ");
      out.write(
          "<link rel=\"stylesheet\" type=\"text/css\" href=\"/wt-portal/css/default.css\" />\r\n  ");
      out.write("<script type=\"text/javascript\" src=\"/wt-portal/javascript/WTtools.js\">");
      out.write("</script>\r\n");
      out.write("</head>\r\n");
      out.write("<body>\r\n");
      String title =
          "Graphs - Real-Time - Windows Page Performance Monitoring for Node: " + strNodeLabel;
      out.write("\r\n");
      request.setAttribute("title", title);
      request.setAttribute("nodeJsp", "/wt-monitor/element/node.jsp?node=" + strNodeId);
      out.write("\r\n");
      /* ----  c:import ---- */
      org.apache.taglibs.standard.tag.el.core.ImportTag _jspx_th_c_import_0 =
          (org.apache.taglibs.standard.tag.el.core.ImportTag)
              _jspx_tagPool_c_import_url_context.get(
                  org.apache.taglibs.standard.tag.el.core.ImportTag.class);
      _jspx_th_c_import_0.setPageContext(pageContext);
      _jspx_th_c_import_0.setParent(null);
      _jspx_th_c_import_0.setContext("/wt-monitor");
      _jspx_th_c_import_0.setUrl("/includes/header.jsp");
      int[] _jspx_push_body_count_c_import_0 = new int[] {0};
      try {
        int _jspx_eval_c_import_0 = _jspx_th_c_import_0.doStartTag();
        if (_jspx_eval_c_import_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
          if (_jspx_eval_c_import_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
            javax.servlet.jsp.tagext.BodyContent _bc = pageContext.pushBody();
            _jspx_push_body_count_c_import_0[0]++;
            out = _bc;
            _jspx_th_c_import_0.setBodyContent(_bc);
            _jspx_th_c_import_0.doInitBody();
          }
          do {
            out.write("\r\n\t");
            if (_jspx_meth_c_param_0(
                _jspx_th_c_import_0, pageContext, _jspx_push_body_count_c_import_0)) return;
            out.write("\r\n\t");
            if (_jspx_meth_c_param_1(
                _jspx_th_c_import_0, pageContext, _jspx_push_body_count_c_import_0)) return;
            out.write("\r\n\t");
            if (_jspx_meth_c_param_2(
                _jspx_th_c_import_0, pageContext, _jspx_push_body_count_c_import_0)) return;
            out.write("\r\n");
            int evalDoAfterBody = _jspx_th_c_import_0.doAfterBody();
            if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break;
          } while (true);
          if (_jspx_eval_c_import_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
            out = pageContext.popBody();
          _jspx_push_body_count_c_import_0[0]--;
        }
        if (_jspx_th_c_import_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return;
      } catch (Throwable _jspx_exception) {
        while (_jspx_push_body_count_c_import_0[0]-- > 0) out = pageContext.popBody();
        _jspx_th_c_import_0.doCatch(_jspx_exception);
      } finally {
        _jspx_th_c_import_0.doFinally();
        _jspx_tagPool_c_import_url_context.reuse(_jspx_th_c_import_0);
      }
      out.write("\t\r\n\t");
      out.write("\r\n");
      out.write("<div align=\"center\">\r\n");
      out.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n\t");
      out.write("<tr>\r\n\t\t");
      out.write("<td align=\"right\">");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagefaultchart&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t\t");
      out.write("<td>");
      out.write(
          "<img src=\"/wt-portal/images/spacers/spacer.gif\" height=\"1\" width=\"20\" border=\"0\" alt=\"WebTelemetry\">");
      out.write("</td>\r\n\t\t");
      out.write("<td>");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagefaultseries&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t");
      out.write("</tr>\r\n\t");
      out.write("<tr>\r\n\t\t");
      out.write("<td align=\"right\">");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagenumchart&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t\t");
      out.write("<td>&nbsp;");
      out.write("</td>\r\n\t\t");
      out.write("<td>");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagenumseries&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t");
      out.write("</tr>\r\n\t");
      out.write("<tr>\r\n\t\t");
      out.write("<td align=\"right\">");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagetimeschart&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t\t");
      out.write("<td>&nbsp;");
      out.write("</td>\r\n\t\t");
      out.write("<td>");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagetimesseries&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t");
      out.write("</tr>\r\n");
      out.write("</table>\r\n");
      out.write("</div>\r\n");
      out.write("<br>\r\n\r\n");
      /* ----  c:import ---- */
      org.apache.taglibs.standard.tag.el.core.ImportTag _jspx_th_c_import_1 =
          (org.apache.taglibs.standard.tag.el.core.ImportTag)
              _jspx_tagPool_c_import_url_context_nobody.get(
                  org.apache.taglibs.standard.tag.el.core.ImportTag.class);
      _jspx_th_c_import_1.setPageContext(pageContext);
      _jspx_th_c_import_1.setParent(null);
      _jspx_th_c_import_1.setContext("/wt-monitor");
      _jspx_th_c_import_1.setUrl("/includes/footer.jsp");
      int[] _jspx_push_body_count_c_import_1 = new int[] {0};
      try {
        int _jspx_eval_c_import_1 = _jspx_th_c_import_1.doStartTag();
        if (_jspx_th_c_import_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return;
      } catch (Throwable _jspx_exception) {
        while (_jspx_push_body_count_c_import_1[0]-- > 0) out = pageContext.popBody();
        _jspx_th_c_import_1.doCatch(_jspx_exception);
      } finally {
        _jspx_th_c_import_1.doFinally();
        _jspx_tagPool_c_import_url_context_nobody.reuse(_jspx_th_c_import_1);
      }
      out.write("\r\n\t\r\n");
      out.write("</body>\r\n");
      out.write("</html>");
    } catch (Throwable t) {
      out = _jspx_out;
      if (out != null && out.getBufferSize() != 0) out.clearBuffer();
      if (pageContext != null) pageContext.handlePageException(t);
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
    }
  }
Exemple #13
0
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    ResultSet rs = null;
    try {
      // SET UP Context environment, to look for Data Pooling Resource
      Context initCtx = new InitialContext();
      Context envCtx = (Context) initCtx.lookup("java:comp/env");
      DataSource ds = (DataSource) envCtx.lookup("jdbc/TestDB");
      Connection dbcon = ds.getConnection();

      // ########### SEARCH INPUT PARAMETERS, EXECUTE search
      // #####################################################
      Vector<String> params = new Vector<String>();
      params.add(request.getParameter("fname"));
      params.add(request.getParameter("lname"));
      params.add(request.getParameter("title"));
      params.add(request.getParameter("year"));
      params.add(request.getParameter("director"));

      List<Movie> movies = new ArrayList<Movie>();
      movies = SQLServices.getMovies(params.toArray(new String[params.size()]), dbcon);

      // ########## SET DEFAULT SESSION() PARAMETERS ####################################
      request.getSession().removeAttribute("movies");
      request.getSession().removeAttribute("linkedListMovies");
      request.getSession().removeAttribute("hasPaged");
      request.getSession().setAttribute("hasPaged", "no");
      request.getSession().setAttribute("movies", movies);
      request.getSession().setAttribute("currentIndex", "0");
      request.getSession().setAttribute("defaultN", "5");

      // ########## IF MOVIES FROM SEARCH NON-EMPTY ###########################################
      List<String> fields = Movie.fieldNames();
      int count = 1;
      if (!movies.isEmpty()) {
        request.setAttribute("movies", movies);
        for (String field : fields) {
          request.setAttribute("f" + count++, field);
        }
        request.getRequestDispatcher("../movieList.jsp").forward(request, response);
      } else {
        out.println("<html><head><title>error</title></head>");
        out.println("<body><h1>could not find any movies, try your search again.</h1>");
        out.println("<p> we are terribly sorry, please go back. </p>");
        out.println("<table border>");
        out.println("</table>");
      }
      dbcon.close();

    } catch (SQLException ex) {
      while (ex != null) {
        System.out.println("SQL Exception:  " + ex.getMessage());
        ex = ex.getNextException();
      }
    } catch (java.lang.Exception ex) {
      out.println(
          "<html>"
              + "<head><title>"
              + "moviedb: error"
              + "</title></head>\n<body>"
              + "<p>SQL error in doGet: "
              + ex.getMessage()
              + "</p></body></html>");
      return;
    }
    out.close();
  }
Exemple #14
0
  // Information needed to get a single file:
  // BASE_PATH, FILE_ID, TIMESTAMP_START, TIMESTAMP_STOP, SOURCE, FILESYSTEM
  private static Vector<Path> getFile(
      FileSystem fs, Hashtable<String, String> config, dbutil db_util) throws Exception {
    Long latestVersion = latestVersion(config, db_util);

    try {
      config.put("timestamp_start", config.get("timestamp_start"));
      config.put("timestamp_real", latestVersion.toString());
      config.put("timestamp_stop", latestVersion.toString());
    } catch (Exception E) {
      logger.error("Tryign to get file that is impossible to generate: " + getFullPath(config));
      return null;
    }
    if (Integer.parseInt(config.get("timestamp_start"))
        > Integer.parseInt(config.get("timestamp_stop"))) {
      return null;
    }
    logger.debug(
        "Getting DB for timestamp "
            + config.get("timestamp_start")
            + " to "
            + config.get("timestamp_stop"));

    String final_result = getFullPath(config);

    String temp_path_base =
        config.get("local_temp_path")
            + "_"
            + config.get("task_id")
            + "_"
            + config.get("run_id")
            + "/";
    Path newPath = new Path(final_result + "*");
    Vector<Path> ret_path = new Vector<Path>();
    String lockName = lock(final_result.replaceAll("/", "_"));
    if (fs.globStatus(newPath).length != 0) {
      ret_path.add(newPath);
      unlock(lockName);
      config.put("full_file_name", final_result);
      return ret_path;
    } else {
      if (!config.get("source").equals("local")) {
        config.put("temp_path_base", temp_path_base);

        config.put("timestamp_start", config.get("timestamp_start"));
        config.put("timestamp_real", latestVersion.toString());
        config.put("timestamp_stop", latestVersion.toString());

        Class<?> sourceClass =
            Class.forName("org.gestore.plugin.source." + config.get("source") + "Source");
        Method process_data = sourceClass.getMethod("process", Hashtable.class, FileSystem.class);
        Object processor = sourceClass.newInstance();
        Object retVal;
        try {
          retVal = process_data.invoke(processor, config, fs);
        } catch (InvocationTargetException E) {
          Throwable exception = E.getTargetException();
          logger.error("Unable to call method in child class: " + exception.toString());
          exception.printStackTrace(System.out);
          unlock(lockName);
          return null;
        }
        FileStatus[] files = (FileStatus[]) retVal;
        if (files == null) {
          logger.error("Error getting files, no files returned");
          return null;
        }

        for (FileStatus file : files) {
          Path cur_file = file.getPath();
          Path cur_local_path = new Path(temp_path_base + config.get("file_id"));
          String suffix = getSuffix(config.get("file_id"), cur_file.getName());
          cur_local_path = cur_local_path.suffix(suffix);
          Path res_path = new Path(new String(final_result + suffix));
          logger.debug("Moving file" + cur_file.toString() + " to " + res_path.toString());
          if (config.get("copy").equals("true")) {
            fs.moveFromLocalFile(cur_file, res_path);
          } else {
            fs.rename(cur_file, res_path);
          }
        }

        config.put("full_file_name", final_result);
      }
    }
    unlock(lockName);
    return ret_path;
  }
 public void addAffyProbe(AffyProbe ap) {
   if (!probes.contains(ap)) {
     probes.add(ap);
   }
 }