List of usage examples for java.util.logging Level FINE
Level FINE
To view the source code for java.util.logging Level FINE.
Click Source Link
From source file:de.themoep.chestshoptools.ShopInfoCommand.java
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if (args.length > 0) { return false; }/*ww w . ja v a 2 s . c o m*/ if (!(sender instanceof Player)) { sender.sendMessage(ChatColor.RED + "This command can only be run by a player!"); return true; } Block lookingAt = ((Player) sender).getTargetBlock((Set<Material>) null, 10); if (lookingAt == null) { sender.sendMessage( ChatColor.RED + "Please look at a shop sign or chest!" + ChatColor.DARK_GRAY + " (0)"); return true; } Sign shopSign = null; if (lookingAt.getState() instanceof Chest) { shopSign = uBlock.getConnectedSign((Chest) lookingAt.getState()); } else if (lookingAt.getState() instanceof Sign && ChestShopSign.isValid(lookingAt)) { shopSign = (Sign) lookingAt.getState(); } if (shopSign == null) { sender.sendMessage( ChatColor.RED + "Please look at a shop sign or chest!" + ChatColor.DARK_GRAY + " (1)"); return true; } String name = shopSign.getLine(ChestShopSign.NAME_LINE); String quantity = shopSign.getLine(ChestShopSign.QUANTITY_LINE); String prices = shopSign.getLine(ChestShopSign.PRICE_LINE); String material = shopSign.getLine(ChestShopSign.ITEM_LINE); String ownerName = NameManager.getFullNameFor(NameManager.getUUIDFor(name)); ItemStack item = MaterialUtil.getItem(material); if (item == null || !NumberUtil.isInteger(quantity)) { sender.sendMessage(Messages.prefix(Messages.INVALID_SHOP_DETECTED)); return true; } sender.sendMessage(Messages.prefix(ChatColor.GREEN + "Besitzer: " + ChatColor.WHITE + ownerName)); if (plugin.getShowItem() == null) { sender.sendMessage(Messages.prefix(ChatColor.GREEN + "Item: " + ChatColor.WHITE + material)); } else { String itemJson = plugin.getShowItem().getItemConverter().itemToJson(item, Level.FINE); String icon = ""; if (plugin.getShowItem().useIconRp()) { icon = plugin.getShowItem().getIconRpMap().getIcon(item, true); } JSONArray textJson = new JSONArray(); textJson.add(new JSONObject(ImmutableMap.of("text", Messages.prefix(ChatColor.GREEN + "Item: ")))); JSONObject hoverJson = new JSONObject(); hoverJson.put("action", "show_item"); hoverJson.put("value", itemJson); ChatColor nameColor = plugin.getShowItem().getItemConverter().getNameColor(item); if (plugin.getShowItem().useIconRp()) { JSONObject iconJson = new JSONObject(); iconJson.put("text", icon); iconJson.put("hoverEvent", hoverJson); textJson.add(iconJson); } JSONObject typeJson = new JSONObject(); typeJson.put("translate", plugin.getShowItem().getItemConverter().getTranslationKey(item)); JSONArray translateWith = new JSONArray(); translateWith.addAll(plugin.getShowItem().getItemConverter().getTranslateWith(item)); if (!translateWith.isEmpty()) { typeJson.put("with", translateWith); } typeJson.put("hoverEvent", hoverJson); typeJson.put("color", nameColor.name().toLowerCase()); textJson.add(typeJson); String itemName = plugin.getShowItem().getItemConverter().getCustomName(item); if (!itemName.isEmpty()) { textJson.add(new JSONObject(ImmutableMap.of("text", ": ", "color", "green"))); JSONObject nameJson = new JSONObject(); nameJson.put("text", itemName); nameJson.put("hoverEvent", hoverJson); nameJson.put("color", nameColor.name().toLowerCase()); textJson.add(nameJson); } plugin.getShowItem().tellRaw((Player) sender, textJson.toString()); } sender.sendMessage(Messages.prefix(ChatColor.GREEN + "Anzahl: " + ChatColor.WHITE + quantity)); sender.sendMessage(Messages.prefix(ChatColor.GREEN + "Preis: " + ChatColor.WHITE + prices)); return true; }
From source file:org.geonode.security.GeoNodeCookieProcessingFilter.java
/** * // w ww.j a v a2 s . com * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, * javax.servlet.ServletResponse, javax.servlet.FilterChain) */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final HttpServletRequest httpRequest = (HttpServletRequest) request; final SecurityContext securityContext = SecurityContextHolder.getContext(); final Authentication existingAuth = securityContext.getAuthentication(); final String gnCookie = getGeoNodeCookieValue(httpRequest); final boolean alreadyAuthenticated = existingAuth != null && existingAuth.isAuthenticated(); final boolean anonymous = existingAuth == null || existingAuth instanceof AnonymousAuthenticationToken; // if logging in via geoserver web form, we want to short circuit the cookie // check below which might get triggered with an anon geonode cookie // the result looks like the login worked but because we replace the // auth below, it functionaly fails final boolean loggedInWithPassword = existingAuth instanceof UsernamePasswordAuthenticationToken && alreadyAuthenticated; final boolean hasPreviouslyValidatedGeoNodeCookie = (existingAuth instanceof GeoNodeSessionAuthToken) && existingAuth.getCredentials().equals(gnCookie); if (hasPreviouslyValidatedGeoNodeCookie) existingAuth.setAuthenticated(true); // if we still need to authenticate and we find the cookie, consult GeoNode for // an authentication final boolean authenticationRequired = (!alreadyAuthenticated || anonymous || !hasPreviouslyValidatedGeoNodeCookie); if (!loggedInWithPassword && authenticationRequired && gnCookie != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine( "Found GeoNode cookie - checking if we have the authorizations in cache or if we have to reload from GeoNode"); } try { Object principal = existingAuth == null ? null : existingAuth.getPrincipal(); Collection<? extends GrantedAuthority> authorities = existingAuth == null ? null : existingAuth.getAuthorities(); Authentication authRequest = new GeoNodeSessionAuthToken(principal, gnCookie, authorities); final Authentication authResult = getSecurityManager().authenticate(authRequest); LOGGER.log(Level.FINE, "authResult : {0}", authResult); securityContext.setAuthentication(authResult); } catch (AuthenticationException e) { // we just go ahead and fall back on basic authentication LOGGER.log(Level.WARNING, "Error connecting to the GeoNode server for authentication purposes", e); } } // move forward along the chain chain.doFilter(request, response); }
From source file:edu.harvard.iq.safe.lockss.impl.LOCKSSPlatformStatusHtmlParser.java
/** * * @param is/*from w w w .j a va2s . c o m*/ */ @Override public void getPlatformStatusData(InputStream is) { try { Document doc = DataUtil.load(is, "UTF-8", ""); Element body = doc.body(); // most of the target items are sandwitched by <b> tag // this can be used to reach each target item. String tmpCurrentTime = null; String tmpUpTime = null; String currentTime = null; Elements tags = body.getElementsByTag("b"); for (Element tag : tags) { // get the current-time string: for 1.52.3 or older daemons // this is the ony place to get it. String tagText = tag.text(); logger.log(Level.FINE, "working on tagText={0}", tagText); if (tagText.equals("Daemon Status")) { // find current time and up running currentTime = tag.parent().parent().text(); logger.log(Level.INFO, "currentTime text=[{0}]", currentTime); // "currentTime =Daemon Status lockss.statelib.lib.in.us (usdocspln group) 01:25:55 03/01/12, up 7d5h21m" tmstmpMatcher = currentTimeStampPattern.matcher(currentTime); if (tmstmpMatcher.find()) { logger.log(Level.INFO, "group 0={0}", tmstmpMatcher.group(0)); tmpCurrentTime = tmstmpMatcher.group(1); logger.log(Level.INFO, "Current Time:group 1={0}", tmpCurrentTime); tmpUpTime = tmstmpMatcher.group(2); logger.log(Level.INFO, "UpTime:group 2={0}", tmpUpTime); } } // get the remaining key-value sets if (fieldNameSet.contains(tagText)) { Element parent = tag.parent(); String fieldValue = parent.nextElementSibling().text(); logger.log(Level.FINE, "{0}={1}", new Object[] { tagText, fieldValue }); summaryInfoMap.put(tagText, fieldValue); } } // extract the daemon version and platform info that are located // at the bottom // these data are sandwitched by a <center> tag Elements ctags = body.getElementsByTag("center"); String version = null; String platform = null; for (Element ctag : ctags) { String cText = ctag.text(); logger.log(Level.FINE, "center tag Text={0}", cText); // cText is like this: // Daemon 1.53.3 built 28-Jan-12 01:06:36 on build7.lockss.org, Linux RPM 1 if (StringUtils.isNotBlank(cText) && ctag.child(0).nodeName().equals("font")) { String[] versionPlatform = cText.split(", "); if (versionPlatform.length == 2) { logger.log(Level.INFO, "daemon version={0};platform={1}", versionPlatform); version = DaemonStatusDataUtil.getDaemonVersion(versionPlatform[0]); platform = versionPlatform[1]; } else { // the above regex failed logger.log(Level.WARNING, "String-formatting differs; use pattern matching"); version = DaemonStatusDataUtil.getDaemonVersion(cText); int platformOffset = cText.lastIndexOf(", ") + 2; platform = cText.substring(platformOffset); logger.log(Level.INFO, "platform={0}", platform); } } } if (summaryInfoMap.containsKey("V3 Identity")) { String ipAddress = DaemonStatusDataUtil.getPeerIpAddress(summaryInfoMap.get("V3 Identity")); logger.log(Level.INFO, "ipAddress={0}", ipAddress); if (StringUtils.isNotBlank(ipAddress)) { boxInfoMap.put("host", ipAddress); if (!ipAddress.equals(summaryInfoMap.get("IP Address"))) { summaryInfoMap.put("IP Address", ipAddress); } } else { logger.log(Level.WARNING, "host token is blank or null: use IP Address instead"); logger.log(Level.INFO, "IP Address={0}", summaryInfoMap.get("IP Address")); boxInfoMap.put("host", summaryInfoMap.get("IP Address")); } } // for pre-1.53.3 versions boxInfoMap.put("time", tmpCurrentTime); if (!summaryInfoMap.containsKey("Current Time")) { summaryInfoMap.put("Current Time", tmpCurrentTime); } boxInfoMap.put("up", tmpUpTime); if (!summaryInfoMap.containsKey("Uptime")) { summaryInfoMap.put("Uptime", tmpUpTime); } boxInfoMap.put("version", version); if (!summaryInfoMap.containsKey("Daemon Version")) { summaryInfoMap.put("Daemon Version", version); } boxInfoMap.put("platform", platform); if (!summaryInfoMap.containsKey("Platform")) { summaryInfoMap.put("Platform", platform); } } catch (IOException ex) { logger.log(Level.SEVERE, "IO error", ex); } logger.log(Level.INFO, "boxInfoMap={0}", boxInfoMap); logger.log(Level.INFO, "summaryInfo={0}", summaryInfoMap); }
From source file:com.cloudbees.plugins.deployer.sources.WildcardPathDeploySource.java
/** * {@inheritDoc}/* ww w . j a va 2 s.c o m*/ */ @Override @CheckForNull public FilePath getApplicationFile(@NonNull FilePath workspace) { try { FilePath[] list = workspace.list(getFilePattern()); return list != null && list.length > 0 ? list[0] : null; } catch (IOException e) { LOGGER.log(Level.FINE, Messages.WildcardPathDeploySource_CouldNotListFromWorkspace(getFilePattern(), workspace), e); } catch (InterruptedException e) { LOGGER.log(Level.FINER, Messages.WildcardPathDeploySource_CouldNotListFromWorkspace(getFilePattern(), workspace), e); } return null; }
From source file:com.commsen.jwebthumb.WebThumbService.java
/** * Sends thumbnail requests to webthumb site. For more information see webthumb's request API: * http://webthumb.bluga.net/apidoc#request * /*from w w w.j a v a 2 s . c o m*/ * @param webThumbRequests list of objects containing the request parameters * @return list of jobs * @throws WebThumbException if the request fails for whatever reason */ public List<WebThumbJob> sendRequest(List<WebThumbRequest> webThumbRequests) throws WebThumbException { Validate.notNull(webThumbRequests, "webThumbRequests is null!"); Validate.notEmpty(webThumbRequests, "webThumbRequests is empty!"); Validate.noNullElements(webThumbRequests, "webThumbRequests contains null elements!"); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Attempting to send webThumbRequests: " + webThumbRequests); } WebThumb webThumb = new WebThumb(apikey, webThumbRequests); HttpURLConnection connection = sendWebThumb(webThumb); try { WebThumbResponse webThumbResponse = SimpleXmlSerializer.parseResponse(connection.getInputStream(), WebThumbResponse.class); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Response processed! Returning: " + webThumbResponse.getJobs()); } if (webThumbResponse.getError() != null) { throw new WebThumbException("Server side error: " + webThumbResponse.getError().getValue()); } if (webThumbResponse.getErrors() != null) { for (WebThumbError webThumbError : webThumbResponse.getErrors()) { LOGGER.warning("Server side error: " + webThumbError); } } return webThumbResponse.getJobs(); } catch (IOException e) { throw new WebThumbException("failed to send request", e); } }
From source file:com.cloudbees.jenkins.plugins.bitbucket.hooks.BitbucketSCMSourcePushHookReceiver.java
/** * Receives Bitbucket push notifications. * * @param req Stapler request. It contains the payload in the body content * and a header param "X-Event-Key" pointing to the event type. * @return the HTTP response object/*from w w w .j a v a2s .c o m*/ * @throws IOException if there is any issue reading the HTTP content payload. */ public HttpResponse doNotify(StaplerRequest req) throws IOException { String origin = SCMEvent.originOf(req); String body = IOUtils.toString(req.getInputStream()); String eventKey = req.getHeader("X-Event-Key"); if (eventKey == null) { return HttpResponses.error(HttpServletResponse.SC_BAD_REQUEST, "X-Event-Key HTTP header not found"); } HookEventType type = HookEventType.fromString(eventKey); if (type == null) { LOGGER.info("Received unknown Bitbucket hook: " + eventKey + ". Skipping."); return HttpResponses.error(HttpServletResponse.SC_BAD_REQUEST, "X-Event-Key HTTP header invalid: " + eventKey); } String bitbucketKey = req.getHeader("X-Bitbucket-Type"); String serverUrl = req.getParameter("server_url"); BitbucketType instanceType = null; if (bitbucketKey != null) { instanceType = BitbucketType.fromString(bitbucketKey); } if (instanceType == null && serverUrl != null) { LOGGER.log(Level.FINE, "server_url request parameter found. Bitbucket Native Server webhook incoming."); instanceType = BitbucketType.SERVER; } else { LOGGER.log(Level.FINE, "X-Bitbucket-Type header / server_url request parameter not found. Bitbucket Cloud webhook incoming."); } try { type.getProcessor().process(type, body, instanceType, origin, serverUrl); } catch (AbstractMethodError e) { type.getProcessor().process(body, instanceType); } return HttpResponses.ok(); }
From source file:de.crowdcode.kissmda.cartridges.simplejava.InterfaceGenerator.java
/** * Generate the Class Interface. This is the main generation part for this * SimpleJavaTransformer.//from www. j a v a 2 s .c o m * * @param Class * clazz the UML class * @return CompilationUnit the complete class with its content as a String */ public CompilationUnit generateInterface(Classifier clazz, String sourceDirectoryPackageName) { this.sourceDirectoryPackageName = sourceDirectoryPackageName; logger.log(Level.FINE, "Start generateInterface: " + clazz.getName() + " -----------------------------"); AST ast = AST.newAST(AST.JLS3); CompilationUnit cu = ast.newCompilationUnit(); generatePackage(clazz, ast, cu); TypeDeclaration td = generateClass(clazz, ast, cu); generateMethods(clazz, ast, td); generateGettersSetters(clazz, ast, td); logger.log(Level.INFO, "Compilation unit: \n\n" + cu.toString()); logger.log(Level.FINE, "End generateInterface: " + clazz.getName() + " -----------------------------"); return cu; }
From source file:org.archive.modules.deciderules.ExternalGeoLocationDecideRule.java
@Override protected boolean evaluate(CrawlURI uri) { ExternalGeoLookupInterface impl = getLookup(); if (impl == null) { return false; }/*from ww w . java 2 s.c o m*/ CrawlHost crawlHost = null; String host; InetAddress address; try { host = uri.getUURI().getHost(); crawlHost = serverCache.getHostFor(host); if (crawlHost.getCountryCode() != null) { return countryCodes.contains(crawlHost.getCountryCode()); } address = crawlHost.getIP(); if (address == null) { // TODO: handle transient lookup failures better address = Address.getByName(host); } crawlHost.setCountryCode((String) impl.lookup(address)); if (countryCodes.contains(crawlHost.getCountryCode())) { LOGGER.fine("Country Code Lookup: " + " " + host + crawlHost.getCountryCode()); return true; } } catch (UnknownHostException e) { LOGGER.log(Level.FINE, "Failed dns lookup " + uri, e); if (crawlHost != null) { crawlHost.setCountryCode("--"); } } catch (URIException e) { LOGGER.log(Level.FINE, "Failed to parse hostname " + uri, e); } return false; }
From source file:org.archive.checkpointing.Checkpoint.java
public void saveJson(String beanName, JSONObject json) { try {//from w w w .j a va 2 s . c o m File targetFile = new File(getCheckpointDir().getFile(), beanName); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("saving json to " + targetFile); } FileUtils.writeStringToFile(targetFile, json.toString()); } catch (IOException e) { LOGGER.log(Level.SEVERE, "unable to save checkpoint JSON state of " + beanName, e); setSuccess(false); } }
From source file:com.github.nmorel.gwtjackson.client.ser.bean.AbstractBeanJsonSerializer.java
private InternalSerializer<T> getSerializer(JsonWriter writer, T value, JsonSerializationContext ctx) { if (value.getClass() == getSerializedType()) { return this; }/* w ww .ja v a 2s . c om*/ SubtypeSerializer subtypeSerializer = subtypeClassToSerializer.get(value.getClass()); if (null == subtypeSerializer) { if (ctx.getLogger().isLoggable(Level.FINE)) { ctx.getLogger().fine("Cannot find serializer for class " + value.getClass() + ". Fallback to the serializer of " + getSerializedType()); } return this; } return subtypeSerializer; }