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.gameontext.mediator.PlayerClient.java
/** * Get shared secret for player// w w w . j a v a 2s. c o m * @param playerId * @param jwt * @param oldRoomId * @param newRoomId * @return */ public String getSharedSecret(String playerId, String jwt) { WebTarget target = this.root.path("{playerId}").resolveTemplate("playerId", playerId); Log.log(Level.FINER, this, "requesting shared secret using {0}", target.getUri().toString()); try { // Make PUT request using the specified target, get result as a // string containing JSON Invocation.Builder builder = target.request(MediaType.APPLICATION_JSON); builder.header("Content-type", "application/json"); builder.header("gameon-jwt", jwt); String result = builder.get(String.class); JsonReader p = Json.createReader(new StringReader(result)); JsonObject j = p.readObject(); JsonObject creds = j.getJsonObject("credentials"); return creds.getString("sharedSecret"); } catch (ResponseProcessingException rpe) { Response response = rpe.getResponse(); Log.log(Level.FINER, this, "Exception obtaining shared secret for player, uri: {0} resp code: {1} data: {2}", target.getUri().toString(), response.getStatusInfo().getStatusCode() + " " + response.getStatusInfo().getReasonPhrase(), response.readEntity(String.class)); Log.log(Level.FINEST, this, "Exception obtaining shared secret for player", rpe); } catch (ProcessingException | WebApplicationException ex) { Log.log(Level.FINEST, this, "Exception obtaining shared secret for player (" + target.getUri().toString() + ")", ex); } // Sadly, badness happened while trying to get the shared secret return null; }
From source file:org.cloudifysource.esc.driver.provisioning.openstack.OpenStackNovaClient.java
/** * Terminate a server instance in Openstack. * /* w w w . j av a 2 s .c o m*/ * @param serverId * The server id tto terminate. * @throws OpenstackException * Thrown when something went wrong with the request. */ public void deleteServer(final String serverId) throws OpenstackException { if (logger.isLoggable(Level.FINER)) { logger.log(Level.FINER, "Request=deleteServer: " + serverId); } this.doDelete("servers/" + serverId, CODE_OK_204); }
From source file:edu.usu.sdl.openstorefront.service.SearchServiceImpl.java
@Override public List<ComponentSearchView> getSearchItems(SearchQuery query, FilterQueryParams filter) { // use for advanced search with And - Or combinations on separate fields String queryOperator = " " + SolrAndOr.OR + " "; String myQueryString;/* w w w . ja v a2 s . co m*/ // If incoming query string is blank, default to solar *:* for the full query if (StringUtils.isNotBlank(query.getQuery())) { StringBuilder queryData = new StringBuilder(); Field fields[] = SolrComponentModel.class.getDeclaredFields(); for (Field field : fields) { org.apache.solr.client.solrj.beans.Field fieldAnnotation = field .getAnnotation(org.apache.solr.client.solrj.beans.Field.class); if (fieldAnnotation != null && field.getType() == String.class) { String name = field.getName(); if (StringUtils.isNotBlank(fieldAnnotation.value()) && org.apache.solr.client.solrj.beans.Field.DEFAULT .equals(fieldAnnotation.value()) == false) { name = fieldAnnotation.value(); } queryData.append(SolrEquals.EQUAL.getSolrOperator()).append(name) .append(SolrManager.SOLR_QUERY_SEPERATOR).append(query.getQuery()) .append(queryOperator); } } myQueryString = queryData.toString(); if (myQueryString.endsWith(queryOperator)) { queryData.delete((myQueryString.length() - (queryOperator.length())), myQueryString.length()); myQueryString = queryData.toString(); } } else { myQueryString = SolrManager.SOLR_ALL_QUERY; } log.log(Level.FINER, myQueryString); // execute the searchComponent method and bring back from solr a list array List<SolrComponentModel> resultsList = new ArrayList<>(); try { SolrQuery solrQuery = new SolrQuery(); solrQuery.setQuery(myQueryString); // fields to be returned back from solr solrQuery.setFields(SolrComponentModel.ID_FIELD, SolrComponentModel.ISCOMPONENT_FIELD); solrQuery.setStart(filter.getOffset()); solrQuery.setRows(filter.getMax()); Field sortField = ReflectionUtil.getField(new SolrComponentModel(), filter.getSortField()); if (sortField != null) { String sortFieldText = filter.getSortField(); org.apache.solr.client.solrj.beans.Field fieldAnnotation = sortField .getAnnotation(org.apache.solr.client.solrj.beans.Field.class); if (fieldAnnotation != null) { sortFieldText = fieldAnnotation.value(); } SolrQuery.ORDER order = SolrQuery.ORDER.desc; if (OpenStorefrontConstant.SORT_ASCENDING.equalsIgnoreCase(filter.getSortOrder())) { order = SolrQuery.ORDER.asc; } solrQuery.addSort(sortFieldText, order); } solrQuery.setIncludeScore(true); QueryResponse response = SolrManager.getServer().query(solrQuery); SolrDocumentList results = response.getResults(); DocumentObjectBinder binder = new DocumentObjectBinder(); resultsList = binder.getBeans(SolrComponentModel.class, results); } catch (SolrServerException ex) { throw new OpenStorefrontRuntimeException("Search Failed", "Contact System Admin. Seach server maybe Unavailable", ex); } catch (Exception ex) { log.log(Level.WARNING, "Solr query failed unexpectly; likely bad input.", ex); } //Pulling the full object on the return List<ComponentSearchView> views = new ArrayList<>(); List<String> componentIds = new ArrayList<>(); for (SolrComponentModel result : resultsList) { if (result.getIsComponent()) { componentIds.add(result.getId()); } } //remove bad indexes, if any List<ComponentSearchView> componentSearchViews = getComponentService().getSearchComponentList(componentIds); Set<String> goodComponentIdSet = new HashSet<>(); for (ComponentSearchView view : componentSearchViews) { goodComponentIdSet.add(view.getComponentId()); } for (String componentId : componentIds) { if (goodComponentIdSet.contains(componentId) == false) { log.log(Level.FINE, MessageFormat.format("Removing bad index: {0}", componentId)); deleteById(componentId); } } views.addAll(componentSearchViews); List<ComponentSearchView> articleViews = getAttributeService().getArticlesSearchView(); Map<String, ComponentSearchView> allViews = new HashMap<>(); for (ComponentSearchView componentSearchView : articleViews) { AttributeCodePk attributeCodePk = new AttributeCodePk(); attributeCodePk.setAttributeType(componentSearchView.getArticleAttributeType()); attributeCodePk.setAttributeCode(componentSearchView.getArticleAttributeCode()); allViews.put(attributeCodePk.toKey(), componentSearchView); } for (SolrComponentModel result : resultsList) { if (result.getIsComponent() == false) { ComponentSearchView view = allViews.get(result.getId()); if (view != null) { views.add(view); } else { log.log(Level.FINE, MessageFormat.format("Removing bad index: {0}", result.getId())); deleteById(result.getId()); } } } //TODO: Get the score and sort by score return views; }
From source file:mendeley2kindle.KindleDAO.java
public void saveFile(MFile file, boolean exportHighlights) throws URISyntaxException, IOException { log.log(Level.FINER, "Exporting a document: " + file.getLocalUrl()); File f = new File(new URI(file.getLocalUrl())); FileInputStream fis = new FileInputStream(f); File f2 = new File(toKindleLocalPath(file)); if (f.lastModified() <= f2.lastModified()) { log.log(Level.FINE, "No need to save: " + f2); return;// w ww . jav a2s .c o m } f2.getParentFile().mkdirs(); FileOutputStream fos = new FileOutputStream(f2); byte[] buf = new byte[4096]; for (int read = 0; (read = fis.read(buf)) > 0;) { fos.write(buf, 0, read); } fos.close(); fis.close(); f2.setLastModified(f.lastModified()); log.log(Level.FINE, "Exported a document: " + f2); }
From source file:com.ibm.datapower.amt.clientAPI.Blob.java
/** * Create a new blob object from a file. * //w w w . j ava 2s . com * @param file * a reference to the file that contains the binary data. The * File contents are not read during the constructor, but are * read by the consumer of {@link #getInputStream()}, or they * are read into memory if you call {@link #getByteArray()}. So * it is expected that this File parameter should exist and be * available for reading during the lifetime of this Blob object. * If that is not possible, then you need to use the constructor * {@link #Blob(byte[])}. */ public Blob(File file) { final String METHOD_NAME = "Blob(File)"; //$NON-NLS-1$ this.file = file; String fileName = file.getName(); int index = fileName.lastIndexOf('.'); filenameExtension = fileName.substring(index + 1, fileName.length()); logger.logp(Level.FINER, CLASS_NAME, METHOD_NAME, "Creating Blob from file: " + file.getAbsolutePath()); //$NON-NLS-1$ }
From source file:com.archivas.clienttools.arcutils.utils.net.GetCertsX509TrustManager.java
public void initPersistedTrustManager(boolean forcereload) throws NoSuchAlgorithmException, NoSuchProviderException, KeyStoreException { if (persistedTrustManager != null && !forcereload) { return;//ww w . jav a 2s.c om } String homedir = System.getProperty("user.home"); String fileNameTemplate = ConfigurationHelper.USER_CONFIG_DIRECTORY + ConfigurationHelper.getStringProperty("ssl.keystore.filename", "cacerts"); String fileName = MessageFormat.format(fileNameTemplate, homedir); persistedKeystoreFile = new File(fileName); try { persistedKeyStore = KeyStore.getInstance("JKS"); try { FileInputStream fis = null; if (persistedKeystoreFile.exists()) { fis = new FileInputStream(persistedKeystoreFile); } persistedKeyStore.load(fis, persistedKeystorePassword); } catch (FileNotFoundException e) { // Don't Care. Go on. LOG.log(Level.WARNING, "Unexpected Exception", e); } catch (IOException e) { LOG.log(Level.WARNING, "Unexpected Exception", e); } catch (CertificateException e) { LOG.log(Level.WARNING, "Unexpected Exception", e); } TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init(persistedKeyStore); TrustManager tms[] = tmf.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 < tms.length; i++) { if (tms[i] instanceof X509TrustManager) { persistedTrustManager = (X509TrustManager) tms[i]; break; } } LOG.log(Level.FINER, "persistedTrustManager=" + persistedTrustManager); } catch (KeyStoreException e) { LOG.log(Level.WARNING, "Unexpected Exception", e); throw e; } catch (NoSuchAlgorithmException e) { LOG.log(Level.WARNING, "Unexpected Exception", e); throw e; } catch (RuntimeException e) { LOG.log(Level.WARNING, "Unexpected Exception", e); throw e; } }
From source file:org.jenkinsci.plugins.dockerhub.notification.DockerHubWebHook.java
private WebHookPayload parse(StaplerRequest req) throws IOException { //TODO Actually test what duckerhub is really sending String body = IOUtils.toString(req.getInputStream(), req.getCharacterEncoding()); String contentType = req.getContentType(); if (contentType != null && contentType.startsWith("application/x-www-form-urlencoded")) { body = URLDecoder.decode(body, req.getCharacterEncoding()); }/* w ww .j a v a 2s . c o m*/ logger.log(Level.FINER, "Received commit hook notification : {0}", body); try { JSONObject payload = JSONObject.fromObject(body); return new WebHookPayload(payload); } catch (Exception e) { logger.log(Level.SEVERE, "Could not parse the web hook payload!", e); return null; } }
From source file:es.csic.iiia.planes.behaviors.AbstractBehaviorAgent.java
private void dispatchMessages() { LOG.log(Level.FINER, "{0} dispatching {1} messages.", new Object[] { this, currentMessages.size() }); for (Behavior b : behaviors) { for (Message m : currentMessages) { handle(b, m);// w ww . j a v a 2 s . co m } } }
From source file:com.granule.json.utils.internal.JSONSAXHandler.java
/** * Internal method to end the JSON generation and to write out the resultant JSON text * and reset the internal state of the hander. *//*from w w w. ja v a 2 s .c o m*/ private void endJSON() throws SAXException { if (logger.isLoggable(Level.FINER)) logger.entering(className, "endJSON()"); try { this.head.writeObject(this.osWriter, 0, true, this.compact); this.head = null; this.current = null; this.previousObjects.clear(); } catch (Exception ex) { SAXException saxEx = new SAXException(ex); saxEx.initCause(ex); throw saxEx; } if (logger.isLoggable(Level.FINER)) logger.exiting(className, "endJSON()"); }
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(); }// w ww. j a v a 2 s . co m } 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; }