List of usage examples for java.util.logging Level FINER
Level FINER
To view the source code for java.util.logging Level FINER.
Click Source Link
From source file:org.cloudifysource.esc.driver.provisioning.openstack.OpenStackNovaClient.java
/** * Get an instance by ip.//from w w w. j a v a2s.c o m * * @param serverIp * The ip of the server to get. * @return The server instance that match the ip. * @throws OpenstackException * Thrown when something went wrong with the request. */ public NovaServer getServerByIp(final String serverIp) throws OpenstackException { if (logger.isLoggable(Level.FINER)) { logger.log(Level.FINER, "Request=getServerWithIp"); } final List<NovaServer> servers = this.getServers(); for (final NovaServer server : servers) { final NovaServer serverDetails = this.getServerDetails(server.getId()); if (serverDetails != null) { final List<NovaServerAddress> addresses = serverDetails.getAddresses(); if (addresses != null) { for (final NovaServerAddress novaServerAddress : addresses) { final String addr = novaServerAddress.getAddr(); if (StringUtils.equals(addr, serverIp)) { return serverDetails; } } } } } return null; }
From source file:org.apache.cxf.jca.outbound.ManagedConnectionFactoryImpl.java
public ManagedConnection matchManagedConnections(@SuppressWarnings("rawtypes") Set mcs, Subject subject, ConnectionRequestInfo reqInfo) throws ResourceException { if (LOG.isLoggable(Level.FINER)) { LOG.finer("match connections: set=" + mcs + ", subject=" + subject + " reqInfo=" + reqInfo); }//w w w . j a v a 2 s .c om // find the first managed connection that matches the bus and request info @SuppressWarnings("rawtypes") Iterator iter = mcs.iterator(); while (iter.hasNext()) { Object obj = iter.next(); if (!(obj instanceof ManagedConnectionImpl)) { continue; } ManagedConnectionImpl mc = (ManagedConnectionImpl) obj; if (!ObjectUtils.equals(busConfigURL, mc.getManagedConnectionFactoryImpl().getBusConfigURL())) { continue; } if (!ObjectUtils.equals(reqInfo, mc.getRequestInfo())) { continue; } if (LOG.isLoggable(Level.FINER)) { LOG.finer("found matched connection " + mc); } return mc; } return null; }
From source file:com.archivas.clienttools.arcutils.utils.net.GetCertsX509TrustManager.java
public void initStandardTrustManager(KeyStore keystore) throws NoSuchAlgorithmException, NoSuchProviderException, KeyStoreException { TrustManagerFactory factory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); factory.init(keystore);/*from ww w . j ava 2 s .com*/ TrustManager[] trustmanagers = factory.getTrustManagers(); // Iterate over the returned trustmanagers, look for an instance of X509TrustManager. // If found, use that as our "default" trust manager. for (int i = 0; i < trustmanagers.length; i++) { if (trustmanagers[i] instanceof X509TrustManager) { if (standardTrustManager == null) { standardTrustManager = (X509TrustManager) trustmanagers[i]; } // break; LOG.log(Level.FINER, "standardTrustManager=" + trustmanagers[i]); } } }
From source file:com.ibm.jaggr.core.impl.modulebuilder.less.LessModuleBuilder.java
@Override protected String postcss(String css, IResource resource) throws IOException { final String sourceMethod = "postcss"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[] { css, resource }); }/* w ww.java2s .c o m*/ if (resource.getURI().getPath().endsWith(".less")) { //$NON-NLS-1$ css = processLess(resource.getURI().toString(), css); } css = super.postcss(css, resource); if (isTraceLogging) { log.exiting(sourceMethod, sourceMethod, css); } return css; }
From source file:com.postmark.PostmarkMailSender.java
@Override public void send(SimpleMailMessage message) throws MailException { HttpClient httpClient = new DefaultHttpClient(); PostmarkResponse theResponse = new PostmarkResponse(); try {/*from w ww.j av a 2 s . com*/ // Create post request to Postmark API endpoint HttpPost method = new HttpPost("http://api.postmarkapp.com/email"); // Add standard headers required by Postmark method.addHeader("Accept", "application/json"); method.addHeader("Content-Type", "application/json; charset=utf-8"); method.addHeader("X-Postmark-Server-Token", serverToken); method.addHeader("User-Agent", "Postmark-Java"); // Convert the message into JSON content String messageContents = UnicodeEscapeFilterWriter.escape(gson.toJson(message)); logger.log(Level.FINER, "Message contents: " + messageContents); // Add JSON as payload to post request StringEntity payload = new StringEntity(messageContents); payload.setContentEncoding(HTTP.UTF_8); method.setEntity(payload); ResponseHandler<String> responseHandler = new BasicResponseHandler(); try { String response = httpClient.execute(method, responseHandler); logger.log(Level.FINER, "Message response: " + response); theResponse = gson.fromJson(response, PostmarkResponse.class); theResponse.status = PostmarkResponseStatus.SUCCESS; } catch (HttpResponseException hre) { switch (hre.getStatusCode()) { case 401: case 422: logger.log(Level.SEVERE, "There was a problem with the email: " + hre.getMessage()); theResponse.setMessage(hre.getMessage()); theResponse.status = PostmarkResponseStatus.USERERROR; throw new MailSendException("Postmark returned: " + theResponse); case 500: logger.log(Level.SEVERE, "There has been an error sending your email: " + hre.getMessage()); theResponse.setMessage(hre.getMessage()); theResponse.status = PostmarkResponseStatus.SERVERERROR; throw new MailSendException("Postmark returned: " + theResponse); default: logger.log(Level.SEVERE, "There has been an unknow error sending your email: " + hre.getMessage()); theResponse.status = PostmarkResponseStatus.UNKNOWN; theResponse.setMessage(hre.getMessage()); throw new MailSendException("Postmark returned: " + theResponse); } } } catch (Exception e) { logger.log(Level.SEVERE, "There has been an error sending email: " + e.getMessage()); throw new MailSendException("There has been an error sending email", e); } finally { httpClient.getConnectionManager().shutdown(); } }
From source file:com.speed.ob.Obfuscator.java
private static Level parseLevel(String lvl) { if (lvl.equalsIgnoreCase("info")) { return Level.INFO; } else if (lvl.equalsIgnoreCase("warning")) { return Level.WARNING; } else if (lvl.equalsIgnoreCase("fine")) { return Level.FINE; } else if (lvl.equalsIgnoreCase("finer")) { return Level.FINER; } else if (lvl.equalsIgnoreCase("finest")) { return Level.FINEST; } else if (lvl.equalsIgnoreCase("all")) { return Level.ALL; } else if (lvl.equalsIgnoreCase("severe")) { return Level.SEVERE; } else if (lvl.equalsIgnoreCase("config")) { return Level.CONFIG; }// w ww. java 2 s.c o m return Level.INFO; }
From source file:org.b3log.solo.SoloServletListener.java
@Override public void requestInitialized(final ServletRequestEvent servletRequestEvent) { final HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequestEvent.getServletRequest(); final String requestURI = httpServletRequest.getRequestURI(); Stopwatchs.start("Request Initialized[requestURI=" + requestURI + "]"); if (Requests.searchEngineBotRequest(httpServletRequest)) { LOGGER.log(Level.FINER, "Request made from a search engine[User-Agent={0}]", httpServletRequest.getHeader("User-Agent")); httpServletRequest.setAttribute(Keys.HttpRequest.IS_SEARCH_ENGINE_BOT, true); } else {// ww w . j a v a 2s .com // Gets the session of this request final HttpSession session = httpServletRequest.getSession(); LOGGER.log(Level.FINE, "Gets a session[id={0}, remoteAddr={1}, User-Agent={2}, isNew={3}]", new Object[] { session.getId(), httpServletRequest.getRemoteAddr(), httpServletRequest.getHeader("User-Agent"), session.isNew() }); // Online visitor count Statistics.onlineVisitorCount(httpServletRequest); } resolveSkinDir(httpServletRequest); }
From source file:magma.agent.worldmodel.localizer.impl.LocalizerTriangulation.java
/** * Calculates absolute position and directions from the two flags passed * using triangulation. Absolute means with respect to the game fields * coordinate system./*www . ja v a 2s . c o m*/ * @param flag1 first visible landmark with known position * @param flag2 second visible landmark with known position (has to be right * of first) * @param neckAngle the horizontal neck angle of the viewer * @return an array of two Vector3Ds, the first containing the absolute x,y,z * position of the viewer on the field, the second containing no real * vector, but the horizontal, latitudal and rotational absolute body * angles of the viewer */ private PositionOrientation triangulate(ILocalizationFlag flag1, ILocalizationFlag flag2, float neckAngle) { float flag1Direction; float flag2Direction; double r1, r2; // the distance of the player to the flags double dist, dist2; // the distance (square) of the two flags double a; // distance from one flag to intersection // point P3 double h; // distance from P3 to the intersection // Points P1 and P2 of the two circles double x, x1, x2, x3; double y, y1, y2, y3; double ratio; Angle horizontalAbsDirection; float beta; logger.log(Level.FINER, "Triangulation with flags 1:{0} 2:{1}", new Object[] { flag1, flag2 }); // do the calculations flag1Direction = (float) flag1.getHorizontalDirection(); flag2Direction = (float) flag2.getHorizontalDirection(); r1 = flag1.getDistance(); r2 = flag2.getDistance(); x1 = flag1.getKnownPosition().getX(); x2 = flag2.getKnownPosition().getX(); y1 = flag1.getKnownPosition().getY(); y2 = flag2.getKnownPosition().getY(); // calculate the square distance of the two flags dist2 = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); dist = Math.sqrt(dist2); if (dist > r1 + r2) { // the circles would not intersect dist = r1 + r2; dist2 = dist * dist; } else if ((r1 > r2) && (dist + r2 < r1)) { // the circles would not intersect dist = r1 - r2; dist2 = dist * dist; } else if ((r2 > r1) && (dist + r1 < r2)) { // the circles would not intersect dist = r2 - r1; dist2 = dist * dist; } r1 *= r1; r2 *= r2; // a = (r1^2 - r2^2 + d^2 ) / (2 d) // a = distance from flag1 to base point of height line a = (r1 - r2 + dist2) / (2.0 * dist); // h^2 = r1^2 - a^2 // h = height of the triangle flag1, flag2 and my position h = r1 - a * a; if (h < 0.0) h = 0.0; else h = Math.sqrt(h); // calculate middle of intersection line // P3 = P1 + a ( P2 - P1 ) / d x3 = x1 + a * (x2 - x1) / dist; y3 = y1 + a * (y2 - y1) / dist; // two circles intersect usually in 2 points. Find out which one to // select if (flag1Direction > flag2Direction) { // result x = x3 + h ( y2 - y1 ) / d x = x3 + h * (y2 - y1) / dist; // result y = y3 - h ( x2 - x1 ) / d y = y3 - h * (x2 - x1) / dist; } else { x = x3 - h * (y2 - y1) / dist; y = y3 + h * (x2 - x1) / dist; } // TODO: add z position calculation Vector3D position = new Vector3D(x, y, 0); // calculate the absolute direction r1 = flag1.getDistance(); ratio = (y1 - y) / r1; beta = (float) Math.asin(ratio); if (x > x1) { horizontalAbsDirection = Angle.RAD180.subtract(beta).subtract(flag1Direction); } else { horizontalAbsDirection = Angle.rad(beta).subtract(flag1Direction); } // adjust to head angle horizontalAbsDirection = horizontalAbsDirection.subtract(neckAngle); // TODO add vertical direction logger.log(Level.FINER, "Localize pos:({0}, {1}), angles:{2}, neck:{3}", new Object[] { x, y, horizontalAbsDirection, neckAngle }); return new PositionOrientation(position, horizontalAbsDirection); }
From source file:edu.usu.sdl.openstorefront.core.sort.BeanComparator.java
@Override public int compare(T o1, T o2) { T obj1 = o1;/*from w ww .ja v a 2 s .co m*/ T obj2 = o2; if (OpenStorefrontConstant.SORT_ASCENDING.equals(sortDirection)) { obj1 = o2; obj2 = o1; } if (obj1 != null && obj2 == null) { return 1; } else if (obj1 == null && obj2 != null) { return -1; } else if (obj1 != null && obj2 != null) { if (StringUtils.isNotBlank(sortField)) { try { Object o = obj1; Class<?> c = o.getClass(); Field f = c.getDeclaredField(sortField); f.setAccessible(true); if (f.get(o) instanceof Date) { int compare = 0; DateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH); if (BeanUtils.getProperty(obj1, sortField) != null && BeanUtils.getProperty(obj2, sortField) == null) { return 1; } else if (BeanUtils.getProperty(obj1, sortField) == null && BeanUtils.getProperty(obj2, sortField) != null) { return -1; } else if (BeanUtils.getProperty(obj1, sortField) != null && BeanUtils.getProperty(obj2, sortField) != null) { Date value1 = format.parse(BeanUtils.getProperty(obj1, sortField)); Date value2 = format.parse(BeanUtils.getProperty(obj2, sortField)); if (value1 != null && value2 == null) { return 1; } else if (value1 == null && value2 != null) { return -1; } else if (value1 != null && value2 != null) { compare = value1.compareTo(value2); } } return compare; } else { try { String value1 = BeanUtils.getProperty(obj1, sortField); String value2 = BeanUtils.getProperty(obj2, sortField); if (value1 != null && value2 == null) { return 1; } else if (value1 == null && value2 != null) { return -1; } else if (value1 != null && value2 != null) { if (StringUtils.isNotBlank(value1) && StringUtils.isNotBlank(value2) && StringUtils.isNumeric(value1) && StringUtils.isNumeric(value2)) { BigDecimal numValue1 = new BigDecimal(value1); BigDecimal numValue2 = new BigDecimal(value2); return numValue1.compareTo(numValue2); } else { return value1.toLowerCase().compareTo(value2.toLowerCase()); } } } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) { log.log(Level.FINER, MessageFormat.format("Sort field doesn''t exist: {0}", sortField)); } } } catch (ParseException | NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) { try { String value1 = BeanUtils.getProperty(obj1, sortField); String value2 = BeanUtils.getProperty(obj2, sortField); if (value1 != null && value2 == null) { return 1; } else if (value1 == null && value2 != null) { return -1; } else if (value1 != null && value2 != null) { if (StringUtils.isNotBlank(value1) && StringUtils.isNotBlank(value2) && StringUtils.isNumeric(value1) && StringUtils.isNumeric(value2)) { BigDecimal numValue1 = new BigDecimal(value1); BigDecimal numValue2 = new BigDecimal(value2); return numValue1.compareTo(numValue2); } else { return value1.toLowerCase().compareTo(value2.toLowerCase()); } } } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex2) { log.log(Level.FINER, MessageFormat.format("Sort field doesn''t exist: {0}", sortField)); } } } } return 0; }
From source file:mendeley2kindle.KindleDAO.java
public void removeFile(KFile file) { log.log(Level.FINER, "Removing a document:" + file.getName() + " from your kindle"); String path = toKindleLocalPath(file); File f = new File(path); if (f.exists()) { log.log(Level.FINE, "Removed a document:" + f); f.delete();/* ww w . j ava 2s.c o m*/ } else { log.log(Level.FINE, "File not found:" + f); } }