List of usage examples for java.lang Long Long
@Deprecated(since = "9") public Long(String s) throws NumberFormatException
From source file:frames.Screen2.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./*from w w w . j a v a 2 s .c o m*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); Exit = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); DateTF = new javax.swing.JTextField(); Piechart = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(new java.awt.Color(153, 0, 153)); jPanel1.setBackground(new java.awt.Color(22, 110, 22)); Exit.setBackground(new java.awt.Color(255, 0, 0)); Exit.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N Exit.setForeground(new java.awt.Color(255, 255, 255)); Exit.setText("Exit"); Exit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ExitActionPerformed(evt); } }); jTable1.setBackground(java.awt.Color.lightGray); jTable1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(51, 0, 0), 2)); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { "process1", new Long(9729719), new Integer(267839), "TCP", "Listen" }, { "process2", new Long(5930022), new Integer(356118), "TCP", "Established" }, { "process3", new Long(12648669), new Integer(154132), "TCP", "Listen" }, { "process4", new Long(2806211), new Integer(131547), "UDP", "Time_Wait" } }, new String[] { "Process", "MemoryInfo", "IoInfo", "Protocol", "State" }) { Class[] types = new Class[] { java.lang.String.class, java.lang.Long.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class }; public Class getColumnClass(int columnIndex) { return types[columnIndex]; } }); jTable1.setGridColor(new java.awt.Color(51, 0, 0)); jScrollPane1.setViewportView(jTable1); jLabel1.setBackground(new java.awt.Color(255, 51, 0)); jLabel1.setFont(new java.awt.Font("Monotype Corsiva", 3, 36)); // NOI18N jLabel1.setForeground(java.awt.Color.white); jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("Metrics Collector"); jLabel2.setBackground(new java.awt.Color(255, 255, 51)); jLabel2.setForeground(new java.awt.Color(157, 255, 101)); jLabel2.setText("Date"); DateTF.setEditable(false); DateTF.setBackground(new java.awt.Color(255, 153, 153)); DateTF.setFont(new java.awt.Font("Tahoma", 3, 10)); // NOI18N DateTF.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { DateTFActionPerformed(evt); } }); Piechart.setBackground(new java.awt.Color(204, 0, 51)); Piechart.setFont(new java.awt.Font("Tahoma", 1, 8)); // NOI18N Piechart.setForeground(new java.awt.Color(204, 255, 255)); Piechart.setText("Piechart"); Piechart.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { PiechartActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(143, 143, 143).addComponent( jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup().addGap(101, 101, 101).addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 379, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(118, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(DateTF, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(23, 23, 23)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(Exit, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(44, 44, 44)))) .addGroup(jPanel1Layout.createSequentialGroup().addGap(251, 251, 251).addComponent(Piechart) .addGap(0, 0, Short.MAX_VALUE))); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(19, 19, 19) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2).addComponent(DateTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE) .addComponent(jLabel1).addGap(18, 18, 18) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(73, 73, 73).addComponent(Piechart).addGap(67, 67, 67).addComponent(Exit, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(19, 19, 19))); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent( jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); pack(); }
From source file:test.gov.nih.nci.cacoresdk.domain.operations.SpecimenResourceTest.java
/** * Uses Nested Search Criteria for search * Verifies that the results are returned * Verifies size of the result set/* ww w . j a v a2 s . c o m*/ * Verifies that none of the attributes are null * * @throws Exception */ public void testGet() throws Exception { try { Specimen searchObject = new Specimen(); Collection results = getApplicationService().search("gov.nih.nci.cacoresdk.domain.operations.Specimen", searchObject); String id = ""; if (results != null && results.size() > 0) { Specimen obj = (Specimen) ((List) results).get(0); Long idVal = obj.getId(); id = new Long(idVal).toString(); } else return; if (id.equals("")) return; String url = baseURL + "/rest/Specimen/" + id; WebClient client = WebClient.create(url); client.type("application/xml").accept("application/xml"); Response response = client.get(); if (response.getStatus() == Status.NOT_ACCEPTABLE.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() == Status.NOT_FOUND.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } File myFile = new File("Specimen" + "XML.xml"); System.out.println("writing data to file " + myFile.getAbsolutePath()); FileWriter myWriter = new FileWriter(myFile); BufferedReader br = new BufferedReader(new InputStreamReader(((InputStream) response.getEntity()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { myWriter.write(output); System.out.println(output); } myWriter.flush(); myWriter.close(); } catch (Exception e) { e.printStackTrace(); throw e; } }
From source file:com.redhat.rhn.frontend.xmlrpc.chain.ActionChainRPCCommon.java
/** * Resolve packages from IDs.// w w w .j a v a 2 s .c o m * * @param userPackages User packages * @param user User of the system * @return selectedPackages Map of the selected packages */ public List<Map<String, Long>> resolvePackages(List<Integer> userPackages, User user) { List<Map<String, Long>> selected = new ArrayList<Map<String, Long>>(); for (Integer pkgId : userPackages) { Map<String, Long> pkgMap = new HashMap<String, Long>(); Package pkg = PackageManager.lookupByIdAndUser(new Long(pkgId.longValue()), user); if (pkg == null) { throw new InvalidPackageException(pkgId.toString()); } pkgMap.put("name_id", pkg.getPackageName().getId()); pkgMap.put("evr_id", pkg.getPackageEvr().getId()); pkgMap.put("arch_id", pkg.getPackageArch().getId()); selected.add(pkgMap); } return selected; }
From source file:com.googlecode.psiprobe.controllers.connectors.ListConnectorsController.java
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { boolean workerThreadNameSupported = false; List connectors = containerListenerBean.getConnectors(includeRequestProcessors); if (connectors.size() > 0 && ((Connector) connectors.get(0)).getRequestProcessors().size() > 0) { workerThreadNameSupported = ((RequestProcessor) ((Connector) connectors.get(0)).getRequestProcessors() .get(0)).isWorkerThreadNameSupported(); }/* w w w. j a va 2s .c om*/ return new ModelAndView(getViewName()).addObject("connectors", connectors) .addObject("workerThreadNameSupported", Boolean.valueOf(workerThreadNameSupported)) .addObject("collectionPeriod", new Long(getCollectionPeriod())); }
From source file:com.linkedin.cubert.io.text.TextTupleCreator.java
@Override public Tuple create(Object key, Object value) throws ExecException { Text t = (Text) value; String[] fields = t.toString().split(separator); for (int i = 0; i < fields.length; i++) { Object obj = null;/* w ww . jav a 2 s .c o m*/ if (fields[i] != null && fields[i].length() != 0) switch (typeArray[i]) { case INT: obj = new Integer(Integer.parseInt(fields[i])); break; case LONG: obj = new Long(Long.parseLong(fields[i])); break; case STRING: obj = fields[i]; break; case DOUBLE: obj = Double.parseDouble(fields[i]); break; case FLOAT: obj = Float.parseFloat(fields[i]); break; default: break; } tuple.set(i, obj); } return tuple; }
From source file:com.asiainfo.tfsPlatform.web.functional.rest.TaskRestFT.java
/** * //.//from w ww. j ava 2 s . c om */ @Test @Category(Smoke.class) public void createUpdateAndDeleteTask() { // create TaskDto task = TaskData.randomTask(); URI createdTaskUri = restTemplate.postForLocation(resourceUrl, task); System.out.println(createdTaskUri.toString()); TaskDto createdTask = restTemplate.getForObject(createdTaskUri, TaskDto.class); assertThat(createdTask.getTitle()).isEqualTo(task.getTitle()); // update String id = StringUtils.substringAfterLast(createdTaskUri.toString(), "/"); task.setId(new Long(id)); task.setTitle(TaskData.randomTitle()); restTemplate.put(createdTaskUri, task); TaskDto updatedTask = restTemplate.getForObject(createdTaskUri, TaskDto.class); assertThat(updatedTask.getTitle()).isEqualTo(task.getTitle()); // delete restTemplate.delete(createdTaskUri); try { restTemplate.getForObject(createdTaskUri, TaskDto.class); fail("Get should fail while feth a deleted task"); } catch (HttpStatusCodeException e) { assertThat(e.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND); } }
From source file:net.decix.jatlasx.test.HandlerTest.java
@Test public void testMeasurementIDHandler() { boolean receivedData = false; ResponseHandler<Long> handler = new MeasurementIDHandler(); JSONArray jsonTestArrayLong = new JSONArray(); jsonTestArrayLong.put(new Long(10)); jsonTestArrayLong.put(new Long(100)); jsonTestArrayLong.put(new Long(1000)); jsonTestArrayLong.put(new Long(10000)); jsonTestArrayLong.put(new Long(0)); JSONObject obj = new JSONObject(); obj.put("measurements", jsonTestArrayLong); obj.put("num", new Integer(100)); obj.put("balance", new Double(1000.21)); obj.put("is_vip", new Boolean(true)); obj.put("nickname", new Object()); String definitions = new JSONStringer().array().object().key("target").value("192.168.178.1").key("af") .value("4").endObject().object().key("newline").value("123").key("newline2").value("456") .endObject().endArray().toString(); String probes = new JSONStringer().array().object().key("value").value("21931").key("type").value("probes") .key("requested").value("1").endObject().endArray().toString(); String myString = new JSONStringer().object().key("definitions").value(definitions).key("probes") .value(probes).key("measurements").value(jsonTestArrayLong).key("is_oneoff").value(false) .endObject().toString();/*from www . jav a2 s. c o m*/ List<Long> list = handler.handleResponse(myString); if (!list.isEmpty()) { if (PRINT_RESULTS) { System.out.println("TEST (HandlerTest) - MeasurementIDHandler " + list); } receivedData = true; } assertTrue(receivedData); }
From source file:at.ait.dme.yuma.server.image.WebsiteCaptureServiceImpl.java
@Override public String captureSite(String url) throws WebsiteCaptureException { String imageName = ""; try {/*from www . jav a2 s . com*/ imageName = new Long(System.currentTimeMillis()).toString() + ".jpg"; String filename = targetPath + "/" + imageName; Process p = Runtime.getRuntime() .exec("cutycapt --min-width=" + minWidth.toString() + " --url=" + url + " --out=" + filename); if (p.waitFor() != 0) { String errorMessage = ""; InputStream errorStream = p.getErrorStream(); if (errorStream != null) errorMessage = IOUtils.toString(errorStream, "UTF-8"); throw new WebsiteCaptureException("failed to capture site: " + errorMessage); } } catch (Throwable t) { logger.fatal(t.getMessage(), t); throw new WebsiteCaptureException(t); } return RELATIVE_IMAGEURL_PATH + "/" + imageName; }
From source file:de.uzk.hki.da.pkg.TarGZArchiveBuilder.java
public void unarchiveFolder(File srcTar, File destFolder) throws Exception { FileInputStream fin = new FileInputStream(srcTar); BufferedInputStream in = new BufferedInputStream(fin); GzipCompressorInputStream gzIn = new GzipCompressorInputStream(in); TarArchiveInputStream tIn = new TarArchiveInputStream(gzIn); HashMap<String, Long> modDateMap = new HashMap<String, Long>(); TarArchiveEntry entry;// w w w .ja v a2s. com do { entry = tIn.getNextTarEntry(); if (entry == null) break; logger.debug(entry.getName()); String dstName = destFolder.getAbsolutePath() + "/" + entry.getName(); File entryFile = new File(dstName); if (entry.isDirectory()) { entryFile.mkdirs(); modDateMap.put(dstName, new Long(entry.getModTime().getTime())); } else { new File(entryFile.getAbsolutePath().substring(0, entryFile.getAbsolutePath().lastIndexOf('/'))) .mkdirs(); FileOutputStream out = new FileOutputStream(entryFile); IOUtils.copy(tIn, out); out.close(); entryFile.setLastModified(entry.getModTime().getTime()); } } while (true); tIn.close(); gzIn.close(); in.close(); fin.close(); for (Map.Entry<String, Long> moddi : modDateMap.entrySet()) { String key = moddi.getKey(); Long value = moddi.getValue(); (new File(key)).setLastModified(value); } }
From source file:org.sakaiproject.sgs2.server.GroovyShellManagerImpl.java
public Script getScript(String uuid) { return (Script) getHibernateTemplate().get(Script.class, new Long(uuid)); }