List of usage examples for java.util.logging Level FINEST
Level FINEST
To view the source code for java.util.logging Level FINEST.
Click Source Link
From source file:de.hofuniversity.iisys.neo4j.websock.query.encoding.logging.LoggingTSafeJsonQueryHandler.java
@Override public WebsockQuery decode(final String arg0) throws DecodeException { WebsockQuery query = null;/*w w w .j av a2 s . c om*/ try { long time = System.nanoTime(); final JSONObject obj = new JSONObject(arg0); if (fDebug) { fTotalBytesIn += arg0.getBytes().length; fLogger.log(Level.FINEST, "received JSON message: " + arg0.getBytes().length + " bytes\n" + "total bytes received: " + fTotalBytesIn); } query = JsonConverter.fromJson(obj); time = System.nanoTime() - time; //retrieve type if (LOGGING_ENABLED) { String type = null; synchronized (QUERY_TYPES) { type = QUERY_TYPES.get(query.getId()); } //store size of query List<Integer> sizes = null; synchronized (LOGGED_IN_SIZES) { sizes = LOGGED_IN_SIZES.get(type); if (sizes == null) { sizes = new LinkedList<Integer>(); LOGGED_IN_SIZES.put(type, sizes); } } synchronized (sizes) { sizes.add(arg0.getBytes().length); } //store time taken List<Long> times = null; synchronized (LOGGED_IN_TIMES) { times = LOGGED_IN_TIMES.get(type); if (times == null) { times = new LinkedList<Long>(); LOGGED_IN_TIMES.put(type, times); } } synchronized (times) { times.add(time); } } } catch (JSONException e) { e.printStackTrace(); throw new DecodeException(arg0, "failed to decode JSON", e); } return query; }
From source file:de.hofuniversity.iisys.neo4j.websock.query.encoding.unsafe.DeflateJsonQueryHandler.java
@Override public ByteBuffer encode(final WebsockQuery query) throws EncodeException { ByteBuffer result = null;/* w w w . jav a 2 s . co m*/ try { final JSONObject obj = JsonConverter.toJson(query); byte[] data = obj.toString().getBytes(); //compress final Deflater deflater = new Deflater(fCompression, true); deflater.setInput(data); deflater.finish(); int totalSize = 0; int read = deflater.deflate(fBuffer, 0, BUFFER_SIZE, Deflater.SYNC_FLUSH); while (true) { totalSize += read; if (deflater.finished()) { //if finished, directly add buffer fBuffers.add(fBuffer); break; } else { //make a copy, reuse buffer fBuffers.add(Arrays.copyOf(fBuffer, read)); read = deflater.deflate(fBuffer, 0, BUFFER_SIZE, Deflater.SYNC_FLUSH); } } result = fuse(totalSize); deflater.end(); if (fDebug) { fTotalBytesOut += totalSize; fLogger.log(Level.FINEST, "encoded compressed JSON message: " + totalSize + " bytes\n" + "total bytes sent: " + fTotalBytesOut); } } catch (JSONException e) { e.printStackTrace(); throw new EncodeException(query, "failed to encode JSON", e); } return result; }
From source file:org.apache.reef.runtime.azbatch.evaluator.EvaluatorShim.java
/** * Starts the {@link EvaluatorShim}./* ww w .ja va 2s.c om*/ */ public void run() { LOG.log(Level.FINEST, "Entering EvaluatorShim.run()."); this.onStart(); }
From source file:SuperPeer.java
@Override public synchronized String getAddress(Key id) throws Exception { lg.log(Level.FINEST, "getAddress Entry."); PeerInfo fe = null;/*from w ww . ja v a2 s . c om*/ Iterator<PeerInfo> it = peertable.iterator(); while (it.hasNext()) { fe = it.next(); lg.log(Level.FINER, "getAddress - Checking " + fe.getNodeId().toString() + " for match ..."); if (fe.getNodeId().equals(id)) { lg.log(Level.FINER, "getAddress - match found."); lg.log(Level.FINEST, "getAddress Exit."); return fe.getIP(); } } lg.log(Level.WARNING, "getAddress failed on " + id.toString() + ", returning null!"); lg.log(Level.FINEST, "getAddress Entry."); return null; }
From source file:org.apache.reef.runtime.azbatch.evaluator.EvaluatorShim.java
/** * Stops the {@link EvaluatorShim}.// w ww.j av a2s . c om */ public void stop() { LOG.log(Level.FINEST, "Entering EvaluatorShim.stop()."); this.onStop(); }
From source file:es.csic.iiia.planes.util.InverseWishartDistribution.java
private RealMatrix sampleWishart() { final int dim = scaleMatrix.getColumnDimension(); // Build N_{ij} double[][] N = new double[dim][dim]; for (int j = 0; j < dim; j++) { for (int i = 0; i < j; i++) { N[i][j] = random.nextGaussian(); }/*from www. j a v a 2s. c om*/ } if (LOG.isLoggable(Level.FINEST)) { LOG.log(Level.FINEST, "N = {0}", Arrays.deepToString(N)); } // Build V_j double[] V = new double[dim]; for (int i = 0; i < dim; i++) { V[i] = gammas[i].sample(); } if (LOG.isLoggable(Level.FINEST)) { LOG.log(Level.FINEST, "V = {0}", Arrays.toString(V)); } // Build B double[][] B = new double[dim][dim]; // b_{11} = V_1 (first j, where sum = 0 because i == j and the inner // loop is never entered). // b_{jj} = V_j + \sum_{i=1}^{j-1} N_{ij}^2, j = 2, 3, ..., p for (int j = 0; j < dim; j++) { double sum = 0; for (int i = 0; i < j; i++) { sum += Math.pow(N[i][j], 2); } B[j][j] = V[j] + sum; } if (LOG.isLoggable(Level.FINEST)) { LOG.log(Level.FINEST, "B*_jj : = {0}", Arrays.deepToString(B)); } // b_{1j} = N_{1j} * \sqrt V_1 for (int j = 1; j < dim; j++) { B[0][j] = N[0][j] * Math.sqrt(V[0]); B[j][0] = B[0][j]; } if (LOG.isLoggable(Level.FINEST)) { LOG.log(Level.FINEST, "B*_1j = {0}", Arrays.deepToString(B)); } // b_{ij} = N_{ij} * \sqrt V_1 + \sum_{k=1}^{i-1} N_{ki}*N_{kj} for (int j = 1; j < dim; j++) { for (int i = 1; i < j; i++) { double sum = 0; for (int k = 0; k < i; k++) { sum += N[k][i] * N[k][j]; } B[i][j] = N[i][j] * Math.sqrt(V[i]) + sum; B[j][i] = B[i][j]; } } if (LOG.isLoggable(Level.FINEST)) { LOG.log(Level.FINEST, "B* = {0}", Arrays.deepToString(B)); } RealMatrix BMat = new Array2DRowRealMatrix(B); RealMatrix A = cholesky.getL().multiply(BMat).multiply(cholesky.getLT()); if (LOG.isLoggable(Level.FINER)) { LOG.log(Level.FINER, "A* = {0}", Arrays.deepToString(N)); } A = A.scalarMultiply(1 / df); return A; }
From source file:org.cjan.test_collector.Uploader.java
/** * Upload test run and tests to CJAN.org. * * @param groupId groupId/*from w w w. j a v a 2 s . c om*/ * @param artifactId artifactId * @param version version * @param envProps environment properties * @param testResults test results * @throws UploadException if it fails to upload */ public String upload(String groupId, String artifactId, String version, EnvironmentProperties envProps, TestResults testResults) throws UploadException { validate(groupId, "Missing groupId"); validate(artifactId, "Missing artifactId"); validate(version, "Missing version"); validate(envProps, "Missing environment properties"); validate(testResults, "Empty test suite"); LOGGER.info("Uploading test results to CJAN.org"); final TestRun testRun = new TestRun(groupId, artifactId, version, envProps, testResults.getGeneralStatus()); testRun.addTests(testResults.getTests()); if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "Test Run: " + testRun.toString()); } final ObjectMapper mapper = new ObjectMapper(); final String json; try { json = mapper.writeValueAsString(testRun); if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "Test Run: " + testRun.toString()); } } catch (JsonGenerationException e) { throw new UploadException("Error converting test run to JSON: " + e.getMessage(), e); } catch (JsonMappingException e) { throw new UploadException("Error mapping object fields: " + e.getMessage(), e); } catch (IOException e) { throw new UploadException("IO error: " + e.getMessage(), e); } final CloseableHttpClient httpclient = HttpClients.createDefault(); try { RequestConfig config = null; if (isProxyEnabled()) { LOGGER.fine("Using HTTP proxy!"); final HttpHost proxy = new HttpHost(getProxyHost(), Integer.parseInt(getProxyPort())); config = RequestConfig.custom().setProxy(proxy).build(); } final HttpPost post = new HttpPost(getUrl()); if (config != null) { post.setConfig(config); } // add access token to headers post.addHeader("x-access-token", getAccessToken()); // post testrun, get ID back from server, show to user List<NameValuePair> pairs = new ArrayList<NameValuePair>(1); pairs.add(new BasicNameValuePair("json", json)); post.setEntity(new UrlEncodedFormEntity(pairs)); CloseableHttpResponse response = httpclient.execute(post); try { HttpEntity entity = response.getEntity(); String body = EntityUtils.toString(entity); return body; } finally { response.close(); } } catch (ClientProtocolException e) { throw new UploadException("Client protocol error: " + e.getMessage(), e); } catch (IOException e) { throw new UploadException("IO error: " + e.getMessage(), e); } finally { if (httpclient != null) { try { httpclient.close(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Error closing HTTP client: " + e.getMessage(), e); } } } }
From source file:Peer.java
@Override public Key getSuccessor(Key key) throws Exception { lg.log(Level.FINEST, "getSuccessor Entry"); lg.log(Level.FINER, "getSuccessor Calling succ:" + succ + " from peer:" + nodeid + " with key:" + key); // Ensure this peers successor is up to date succ = superpeer.getSuccessor(nodeid); // If we have no successor, this peer is the successor if (succ == null) { return nodeid; }/*from w ww. j a va 2 s. co m*/ // Ensure this peers predecessor is up to date pred = superpeer.getPredecessor(nodeid); // Get the max key value Key max = new Key(BigInteger.valueOf((int) Math.pow(2, hasher.getBitSize()))).pred(); // If this peer knows the which peer that key belongs to ... if ( // Normal increasing range case (nodeid.compare(key) < 0 && key.compare(succ) <= 0) // Modulo case || (pred.compare(nodeid) > 0 && (key.compare(pred) > 0 && key.compare(max) <= 0) || (key.compare(nodeid) <= 0))) { lg.log(Level.FINER, "getSuccessor - Known successor."); lg.log(Level.FINEST, "getSuccesssor Exit"); return succ; } // ... else ask this peers successor else { lg.log(Level.FINER, "getSuccessor - Unknown successor."); try { lg.log(Level.FINEST, "getSuccesssor Exit"); return getPeer(succ).getSuccessor(key); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } lg.log(Level.WARNING, "getSuccessor returning null"); lg.log(Level.FINEST, "getSuccesssor Exit"); return null; }
From source file:org.apache.cxf.sts.claims.LdapClaimsHandler.java
public ProcessedClaimCollection retrieveClaimValues(ClaimCollection claims, ClaimsParameters parameters) { String user = null;/*from www. ja v a 2 s . c o m*/ boolean useLdapLookup = false; Principal principal = parameters.getPrincipal(); if (principal instanceof KerberosPrincipal) { KerberosPrincipal kp = (KerberosPrincipal) principal; StringTokenizer st = new StringTokenizer(kp.getName(), "@"); user = st.nextToken(); } else if (principal instanceof X500Principal) { X500Principal x500p = (X500Principal) principal; LOG.warning("Unsupported principal type X500: " + x500p.getName()); return new ProcessedClaimCollection(); } else if (principal != null) { user = principal.getName(); if (user == null) { LOG.warning("User must not be null"); return new ProcessedClaimCollection(); } useLdapLookup = LdapUtils.isDN(user); } else { LOG.warning("Principal is null"); return new ProcessedClaimCollection(); } if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Retrieve claims for user " + user); } Map<String, Attribute> ldapAttributes = null; if (useLdapLookup) { AttributesMapper mapper = new AttributesMapper() { public Object mapFromAttributes(Attributes attrs) throws NamingException { Map<String, Attribute> map = new HashMap<String, Attribute>(); NamingEnumeration<? extends Attribute> attrEnum = attrs.getAll(); while (attrEnum.hasMore()) { Attribute att = attrEnum.next(); map.put(att.getID(), att); } return map; } }; Object result = ldap.lookup(user, mapper); ldapAttributes = CastUtils.cast((Map<?, ?>) result); } else { List<String> searchAttributeList = new ArrayList<String>(); for (Claim claim : claims) { if (getClaimsLdapAttributeMapping().keySet().contains(claim.getClaimType().toString())) { searchAttributeList.add(getClaimsLdapAttributeMapping().get(claim.getClaimType().toString())); } else { if (LOG.isLoggable(Level.FINER)) { LOG.finer("Unsupported claim: " + claim.getClaimType()); } } } String[] searchAttributes = null; searchAttributes = searchAttributeList.toArray(new String[searchAttributeList.size()]); ldapAttributes = LdapUtils.getAttributesOfEntry(ldap, this.userBaseDn, this.getObjectClass(), this.getUserNameAttribute(), user, searchAttributes); } if (ldapAttributes == null || ldapAttributes.size() == 0) { //No result if (LOG.isLoggable(Level.INFO)) { LOG.finest("User '" + user + "' not found"); } return new ProcessedClaimCollection(); } ProcessedClaimCollection claimsColl = new ProcessedClaimCollection(); for (Claim claim : claims) { URI claimType = claim.getClaimType(); String ldapAttribute = getClaimsLdapAttributeMapping().get(claimType.toString()); Attribute attr = ldapAttributes.get(ldapAttribute); if (attr == null) { if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Claim '" + claim.getClaimType() + "' is null"); } } else { ProcessedClaim c = new ProcessedClaim(); c.setClaimType(claimType); c.setPrincipal(principal); StringBuilder claimValue = new StringBuilder(); try { NamingEnumeration<?> list = (NamingEnumeration<?>) attr.getAll(); while (list.hasMore()) { Object obj = list.next(); if (!(obj instanceof String)) { LOG.warning("LDAP attribute '" + ldapAttribute + "' has got an unsupported value type"); break; } String itemValue = (String) obj; if (this.isX500FilterEnabled()) { try { X500Principal x500p = new X500Principal(itemValue); itemValue = x500p.getName(); int index = itemValue.indexOf('='); itemValue = itemValue.substring(index + 1, itemValue.indexOf(',', index)); } catch (Exception ex) { //Ignore, not X500 compliant thus use the whole string as the value } } claimValue.append(itemValue); if (list.hasMore()) { claimValue.append(this.getDelimiter()); } } } catch (NamingException ex) { LOG.warning("Failed to read value of LDAP attribute '" + ldapAttribute + "'"); } c.addValue(claimValue.toString()); // c.setIssuer(issuer); // c.setOriginalIssuer(originalIssuer); // c.setNamespace(namespace); claimsColl.add(c); } } return claimsColl; }
From source file:be.fedict.eidviewer.lib.file.imports.Version35CSVFile.java
public void load(File file) throws CertificateException, FileNotFoundException, IOException { logger.fine("Loading Version 35X CSV File"); String line = null;/* w w w .ja va 2 s.c om*/ certificateFactory = CertificateFactory.getInstance("X.509"); InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file), "utf-8"); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); line = bufferedReader.readLine(); if (line != null) { String[] tokens = line.split(";"); for (int tokenNumber = 0; (variableCertCount < 0) && (tokenNumber < tokens.length); tokenNumber++) { String token = tokens[tokenNumber]; logger.log(Level.FINEST, "token #{0} : [{1}]", new Object[] { tokenNumber, token }); try { switch (tokenNumber) { case DOCUMENTTYPE: identity = new Identity(); identity.documentType = DocumentType.toDocumentType(token.getBytes("utf-8")); if (identity.documentType == null) logger.log(Level.SEVERE, "Unknown Document Type \"{0}\"", token); break; case FIRSTNAMES: TextFormatHelper.setFirstNamesFromString(identity, token); break; case LASTNAME: identity.name = token; break; case GENDER: identity.gender = token.equals("M") ? Gender.MALE : Gender.FEMALE; break; case BIRTHDATE: { logger.fine("field BIRTHDATE"); DateOfBirthDataConvertor dateOfBirthConvertor = new DateOfBirthDataConvertor(); identity.dateOfBirth = dateOfBirthConvertor.convert(token.getBytes("utf-8")); } break; case PLACEOFBIRTH: identity.placeOfBirth = token; break; case NATIONALITY: identity.nationality = token; break; case NATIONALNUMBER: identity.nationalNumber = token; break; case CARDNUMBER: identity.cardNumber = token; break; case CARDCHIPNUMBER: identity.chipNumber = token; break; case CARDVALIDFROM: { GregorianCalendar validityBeginCalendar = new GregorianCalendar(); try { validityBeginCalendar.setTime(dateFormat.parse(token)); identity.cardValidityDateBegin = validityBeginCalendar; } catch (ParseException ex) { logger.log(Level.SEVERE, "Failed to parse Card Validity Start Date \"" + token + "\"", ex); } } break; case CARDVALIDUNTIL: GregorianCalendar validityEndCalendar = new GregorianCalendar(); try { validityEndCalendar.setTime(dateFormat.parse(token)); identity.cardValidityDateEnd = validityEndCalendar; } catch (ParseException ex) { logger.log(Level.SEVERE, "Failed to parse Card Validity End Date \"" + token + "\"", ex); } break; case CARDISSUINGMUNICIPALITY: identity.cardDeliveryMunicipality = token; break; case STREETANDNUMBER: address = new Address(); address.streetAndNumber = token; break; case ZIP: address.zip = token; break; case MUNICIPALITY: address.municipality = token; break; case PHOTO: byte[] tokenBytes = token.getBytes(); eidData.setPhoto(Base64.decodeBase64(tokenBytes)); break; case RRNCERTIFICATE: logger.finer("Gathering RRN Certificate"); try { rrnCert = (X509Certificate) certificateFactory.generateCertificate( new ByteArrayInputStream(Base64.decodeBase64(token.getBytes()))); } catch (CertificateException ex) { logger.log(Level.SEVERE, "Failed to RRN Certificate", ex); } break; case CERTCOUNT: logger.finer("Certificate Count: [" + token + "]"); variableCertCount = Integer.parseInt(token); break; } } catch (UnsupportedEncodingException ex) { logger.log(Level.SEVERE, "Unsupported Encoding for Token " + tokenNumber, ex); } catch (DataConvertorException ex) { logger.log(Level.SEVERE, "Couldn't Convert Date \"" + tokens[tokenNumber] + "\" in Token " + tokenNumber, ex); } } // done looping over fixed parts.. if (identity != null) { TextFormatHelper.setFirstNamesFromStrings(identity, identity.getFirstName(), identity.getMiddleName()); eidData.setIdentity(identity); } if (address != null) eidData.setAddress(address); // get variableCertCount variable certs for (int i = 0; i < variableCertCount; i++) { X509Certificate thisCertificate = null; int certOffset = CERTBASE + (CERTFIELDS * i); String certType = tokens[certOffset + CERT_NAME_OFFSET]; String certData = tokens[certOffset + CERT_DATA_OFFSET]; logger.finer("Gathering " + certType + " Certificate"); try { thisCertificate = (X509Certificate) certificateFactory.generateCertificate( new ByteArrayInputStream(Base64.decodeBase64(certData.getBytes()))); } catch (CertificateException ex) { logger.log(Level.SEVERE, "Failed to Convert Signing Certificate", ex); thisCertificate = null; } if (thisCertificate != null) { if (certType.equalsIgnoreCase("Authentication")) authenticationCert = thisCertificate; else if (certType.equalsIgnoreCase("Signature")) signingCert = thisCertificate; else if (certType.equalsIgnoreCase("CA")) citizenCert = thisCertificate; else if (certType.equalsIgnoreCase("Root")) rootCert = thisCertificate; } } } if (rootCert != null && citizenCert != null) { logger.fine("Certificates were gathered"); if (rrnCert != null) { logger.fine("Setting RRN Certificate Chain"); List<X509Certificate> rrnChain = new LinkedList<X509Certificate>(); rrnChain.add(rrnCert); rrnChain.add(rootCert); eidData.setRRNCertChain(new X509CertificateChainAndTrust( TrustServiceDomains.BELGIAN_EID_NATIONAL_REGISTRY_TRUST_DOMAIN, rrnChain)); } if (authenticationCert != null) { logger.fine("Setting Authentication Certificate Chain"); List<X509Certificate> authChain = new LinkedList<X509Certificate>(); authChain.add(authenticationCert); authChain.add(citizenCert); authChain.add(rootCert); eidData.setAuthCertChain(new X509CertificateChainAndTrust( TrustServiceDomains.BELGIAN_EID_AUTH_TRUST_DOMAIN, authChain)); } if (signingCert != null) { logger.fine("Setting Signing Certificate Chain"); List<X509Certificate> signChain = new LinkedList<X509Certificate>(); signChain.add(signingCert); signChain.add(citizenCert); signChain.add(rootCert); eidData.setSignCertChain(new X509CertificateChainAndTrust( TrustServiceDomains.BELGIAN_EID_NON_REPUDIATION_TRUST_DOMAIN, signChain)); } } inputStreamReader.close(); }