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:com.cedarsoft.couchdb.CouchDatabase.java
/** * Puts the document/*from ww w . j a va 2 s.c om*/ * * @param doc the couch document (contains the object) * @param serializer the serializer that is used to serialize the object contained within the document * @param <T> the type * @return the response * * @throws ActionFailedException */ @Nonnull public <T> ActionResponse put(@Nonnull CouchDoc<T> doc, @Nonnull JacksonSerializer<? super T> serializer) throws ActionFailedException, IOException { WebResource path = getDbRoot().path(doc.getId().asString()); if (LOG.isLoggable(Level.FINE)) { LOG.fine("PUT " + path.toString()); } ClientResponse clientResponse = path.type(JSON_TYPE).accept(JSON_TYPE).put(ClientResponse.class, couchDocSerializer.serialize(doc, serializer)); ActionResponse actionResponse = ActionResponseSerializer.create(clientResponse); //Update the rev doc.setRev(actionResponse.getRev()); return actionResponse; }
From source file:hudson.plugins.script_realm_extended.ExtendedScriptSecurityRealm.java
protected GrantedAuthority[] loadGroups(String username) throws AuthenticationException { try {/*from www. ja va 2 s .c om*/ List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(); authorities.add(AUTHENTICATED_AUTHORITY); if (!StringUtils.isBlank(groupsCommandLine)) { StringWriter out = new StringWriter(); LocalLauncher launcher = new LocalLauncher(new StreamTaskListener(out)); OutputStream scriptOut = new ByteArrayOutputStream(); if (launcher.launch().cmds(QuotedStringTokenizer.tokenize(groupsCommandLine)).stdout(scriptOut) .envs("U=" + username).join() == 0) { StringTokenizer tokenizer = new StringTokenizer(scriptOut.toString().trim(), groupsDelimiter); while (tokenizer.hasMoreTokens()) { final String token = tokenizer.nextToken().trim(); String[] args = new String[] { token, username }; LOGGER.log(Level.FINE, "granting: {0} to {1}", args); authorities.add(new GrantedAuthorityImpl(token)); } } else { throw new BadCredentialsException(out.toString()); } } return authorities.toArray(new GrantedAuthority[0]); } catch (InterruptedException e) { throw new AuthenticationServiceException("Interrupted", e); } catch (IOException e) { throw new AuthenticationServiceException("Failed", e); } }
From source file:eu.europa.ejusticeportal.dss.applet.model.action.OpenPdfAction.java
/** * Tries to open file using java.awt.Desktop * @param url the file to open//from ww w.j a v a 2 s.c o m * @throws Exception if desktop not available */ private void openDesktop(String url) throws Exception { final Class<?> d = Class.forName("java.awt.Desktop"); LOG.log(Level.FINE, "URI to open : " + "file:///{0}", url.replace("\\", "/")); d.getDeclaredMethod("browse", new Class[] { java.net.URI.class }).invoke( d.getDeclaredMethod("getDesktop").invoke(null), new Object[] { java.net.URI.create("file:///" + url.replace("\\", "/")) }); LOG.log(Level.FINE, "java.awt.Desktop.getDesktop().browse() available"); // above code mimics: java.awt.Desktop.getDesktop().browse() }
From source file:com.pivotal.gemfire.tools.pulse.internal.log.PulseLogWriter.java
@Override public boolean fineEnabled() { return logger.isLoggable(Level.FINE); }
From source file:edu.umass.cs.reconfiguration.AbstractReconfiguratorDB.java
/***************** Paxos related methods below ***********/ @Override//from w ww.j a v a 2s. co m public boolean execute(Request request, boolean doNotReplyToClient) { log.log(Level.FINE, "{0} executing {1}", new Object[] { this, request }); if (request.getServiceName().equals(Request.NO_OP) && request.toString().equals(Request.NO_OP)) return true; assert (request instanceof BasicReconfigurationPacket<?>) : request; boolean handled = false; // cast checked by assert above @SuppressWarnings("unchecked") BasicReconfigurationPacket<NodeIDType> rcPacket = (BasicReconfigurationPacket<NodeIDType>) request; if (this.uglyRecoveryHack(rcPacket, this.recovering)) handled = true; else handled = (Boolean) AbstractReconfiguratorDB.autoInvokeMethod(this, rcPacket, doNotReplyToClient, this.consistentNodeConfig); return handled; }
From source file:com.marvelution.hudson.plugins.apiv2.servlet.filter.HudsonAPIV2ServletFilter.java
/** * Internal method to validate that the correct {@link RuntimeDelegate} is loaded for the Wink application *//*from w ww . j a v a 2 s . c o m*/ private void validateRuntimeDelegate() { RuntimeDelegate runtimeDelegate = RuntimeDelegate.getInstance(); if (!(runtimeDelegate instanceof RuntimeDelegateImpl)) { // This issue was found when Hudson/Jenkins is deployed on Glassfish. // Then the default RuntimeDelegate is used and not the Apache Wink implementation // Override the default implementation with the Apache Wink implementation LOGGER.log(Level.FINE, "Overriding RuntimeDelegate of type [" + runtimeDelegate.getClass() + "] with the Wink implementation [" + RuntimeDelegateImpl.class.getName() + "]"); RuntimeDelegate.setInstance(new RuntimeDelegateImpl()); } }
From source file:com.prowidesoftware.swift.io.parser.XMLParser.java
/** * Helper method for XML representation parsing.<br> * Given the <block1> node in the XML tree, returns the SwiftBlock1 object. * * @param blockNode Node object of the <block1> tag in the XML message * @return SwiftBlock1 object populated with the given portion of the XML message *//*from www .j a v a2 s . co m*/ private SwiftBlock1 getBlock1FromNode(final Node blockNode) { final NodeList fields = blockNode.getChildNodes(); if (log.isLoggable(Level.FINE)) { log.fine(fields.getLength() + " children in <block1>"); } final SwiftBlock1 b1 = new SwiftBlock1(); for (int i = 0; i < fields.getLength(); i++) { final Node n = fields.item(i); if ("APPLICATIONID".equalsIgnoreCase(n.getNodeName())) { b1.setApplicationId(getText(n)); } else if ("SERVICEID".equalsIgnoreCase(n.getNodeName())) { b1.setServiceId(getText(n)); } else if ("LOGICALTERMINAL".equalsIgnoreCase(n.getNodeName())) { b1.setLogicalTerminal(getText(n)); } else if ("SESSIONNUMBER".equalsIgnoreCase(n.getNodeName())) { b1.setSessionNumber(getText(n)); } else if ("SEQUENCENUMBER".equalsIgnoreCase(n.getNodeName())) { b1.setSequenceNumber(getText(n)); } else if ("unparsedTexts".equalsIgnoreCase(n.getNodeName())) { b1.setUnparsedTexts(getUnparsedTextsFromNode(n)); } } return b1; }
From source file:edu.umass.cs.gigapaxos.testing.TESTPaxosApp.java
private boolean handleDecision(ProposalPacket requestPacket, boolean doNotReplyToClient) { if (APP_DELAY > 0) return wasteTime(APP_DELAY); else if (ABSOLUTE_NOOP) return true; // else the older testing code try {/*from w w w. java 2 s . c o m*/ String paxosID = requestPacket.getPaxosID(); PaxosState state = this.allState.putIfAbsent(paxosID, state = new PaxosState(paxosID)); /* * Initialize seqnum upon first decision. We know it is the first * decision if seqnum==-1 or if putState is true, i.e., checkpoint * recovery has just happened and no other request has been * executed. */ if (state.seqnum == -1) state.seqnum = requestPacket.slot; else state.seqnum++; log.log(Level.FINE, "Node{0} executing {1}; seqnum={2}, prev_state={3}", new Object[] { (this.niot != null ? getMyID() : "[?]"), requestPacket.getSummary(), state.seqnum, Util.truncate(state.value, 16, 16) }); /* * Set state to current request value concatenated with the hash of * the previous state. This allows us to easily compare using just * the current state value that two RSMs executed the exact same set * of state transitions to arrive at that state. */ if (TESTPaxosConfig.shouldAssertRSMInvariant()) state.value = requestPacket.requestValue + digest(state.value); /* * Assert that the next slot is always the next expected seqnum. * This ensures that paxos is making the app execute requests in the * correct slot number order. Note that state.seqnum is set exactly * once at initialization to the arriving request's slot above and * is then just incremented by one below for every executed * decision. */ assert (state.seqnum == requestPacket.slot) : "state.seqnum = " + state.seqnum + " , requestPacket.slot = " + requestPacket.slot; // maintain executed sequence if shouldAssertRSMInvariant if (TESTPaxosConfig.shouldAssertRSMInvariant()) { if (state.committed == null) state.committed = new LinkedHashMap<Integer, String>() { private static final long serialVersionUID = 1L; private static final int MAX_ENTRIES = 1000; protected boolean removeEldestEntry(Map.Entry<Integer, String> eldest) { if (this.size() > MAX_ENTRIES) return true; return false; } }; state.committed.put(state.seqnum, state.value); } state.numExecuted++; if (TESTPaxosConfig.shouldAssertRSMInvariant()) assert (RSMInvariant(requestPacket.getPaxosID(), requestPacket.slot)) : requestPacket; state.committed.remove(state.seqnum - MAX_STORED_REQUESTS); // GC if (TESTPaxosConfig.PAXOS_MANAGER_UNIT_TEST) synchronized (this) { this.notify(); } assert (requestPacket.requestID >= 0) : requestPacket.toString(); if (!doNotReplyToClient && niot != null) { this.sendResponseToClient(requestPacket); } else log.log(Level.FINE, "Node{0} not sending reply {1} to client", new Object[] { getMyID(), requestPacket.getSummary() }); } catch (JSONException je) { je.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } return true; }
From source file:eu.edisonproject.training.wsd.Wikidata.java
@Override public Set<Term> getCandidates(String lemma) throws MalformedURLException, IOException, ParseException, InterruptedException, ExecutionException { Set<String> termsStr = getPossibleTermsFromDB(lemma, new URL(PAGE).getHost()); if (termsStr != null && !termsStr.isEmpty()) { Set<Term> terms = TermFactory.create(termsStr); return terms; // Set<Term> wikiTerms = new HashSet<>(); // for (Term t : terms) { // if (t.getUrl().toString().contains(new URL(PAGE).getHost())) { // wikiTerms.add(t); // } // } // if (!wikiTerms.isEmpty()) { // return wikiTerms; // } }// w ww. ja va 2 s . c om // if (termsStr != null) { // Set<Term> terms = TermFactory.create(termsStr); // Set<Term> possibleTerms = new HashSet<>(); // for (Term t : terms) { // boolean add = true; // for (CharSequence g : t.getGlosses()) { // if (g != null && g.toString().contains("Wikimedia disambiguation PAGE")) { // add = false; // break; // } // } // if (add) { // possibleTerms.add(t); // } // } // return possibleTerms; // } String query = lemma.replaceAll("_", " "); query = URLEncoder.encode(query, "UTF-8"); int i = 0; URL url = new URL(PAGE + "?action=wbsearchentities&format=json&language=en&continue=" + i + "&limit=50&search=" + query); Logger.getLogger(Wikidata.class.getName()).log(Level.FINE, url.toString()); String jsonString = IOUtils.toString(url); Set<Term> terms = queryTerms(jsonString, lemma); addPossibleTermsToDB(lemma, terms); return terms; }
From source file:fr.ortolang.diffusion.seo.SeoServiceBean.java
@Override public String prerenderSiteMap() throws SeoServiceException, ParserConfigurationException, TransformerException { LOGGER.log(Level.INFO, "Start prerendering Site Map"); Document document = generateSiteMapDocument(); NodeList nodes = document.getElementsByTagNameNS(SITEMAP_NS_URI, "loc"); Runnable command = () -> { int errors = 0; for (int i = 0; i < nodes.getLength(); i++) { String url = nodes.item(i).getTextContent(); LOGGER.log(Level.FINE, "Prerendering url: " + url); Response response = client.target(url).request().header("User-Agent", ORTOLANG_USER_AGENT).get(); response.close();//w w w . ja va 2s. com if (response.getStatusInfo().getStatusCode() != 200 && response.getStatusInfo().getStatusCode() != 304) { LOGGER.log(Level.SEVERE, "An unexpected issue occurred while prerendering the url " + url + " : " + response.getStatusInfo().getStatusCode() + " " + response.getStatusInfo().getReasonPhrase()); errors++; } try { Thread.sleep(200); } catch (InterruptedException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } } if (errors > 0) { LOGGER.log(Level.SEVERE, "Site Map prerendering done with " + errors + " errors."); } else { LOGGER.log(Level.INFO, "Site Map prerendering done"); } }; executor.execute(command); return generateSiteMap(document); }