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:core.messaging.Messenger.java
private void send(UserFeatureProfileDestinationProfile userFeatureProfileDestinationProfile, String from, String subject, String body, ByteArrayDataSource attachment) { Destination destination = userFeatureProfileDestinationProfile.getDestination(); Schedule schedule = userFeatureProfileDestinationProfile.getSchedule(); Calendar userLocalTime = Calendar.getInstance(destination.getUser().getTimeZone()); Date lastMessagedOn = new Date(); if (userFeatureProfileDestinationProfile.isActive() && schedule.isActive() && destination.isActive()) { //// if ( attachment != null && !destination.getType().isAttachmentSupported()) { //// logger.log(Level.WARNING, "Destination does not support attachments, skipping destination for message with attachment"); //// return; //// } //if ( schedule.isRunnable(userLocalTime) ) { sendImmediately(destination.getAddress(), from, subject, body, attachment); //} else { // long nextRunnableTime = schedule.calculateNextRunnableTime(userLocalTime); // if (nextRunnableTime> 0) { // lastMessagedOn = new Date(nextRunnableTime); // queueMessage(nextRunnableTime, destination.getAddress(), from, subject, body, attachment) ; // }/*from w ww .ja v a2 s . c om*/ //} if (destination.getFirstMessagedOn() == null) { destination.setFirstMessagedOn(new Date()); } destination.setLastMessagedOn(lastMessagedOn); destination.setTotalMessagesSent(destination.getTotalMessagesSent() + 1); destination = destination.save(); userFeatureProfileDestinationProfile.setLastMessageSendAllowedOn(lastMessagedOn); userFeatureProfileDestinationProfile = userFeatureProfileDestinationProfile.save(); } else { logger.log(Level.FINE, "userFeatureProfileDestinationProfile, schedule or destination not active (userFeatureProfileDestinationProfileId={0},scheduleId={1},destinationId={2})", new Object[] { userFeatureProfileDestinationProfile.getId(), schedule.getId(), destination.getId() }); } }
From source file:edu.harvard.iq.dataverse.HandlenetServiceBean.java
public Throwable registerNewHandle(Dataset dataset) { logger.log(Level.FINE, "registerNewHandle"); String handlePrefix = dataset.getAuthority(); String handle = getDatasetHandle(dataset); String datasetUrl = getRegistrationUrl(dataset); logger.info("Creating NEW handle " + handle); String authHandle = getHandleAuthority(dataset); PublicKeyAuthenticationInfo auth = getAuthInfo(handlePrefix); HandleResolver resolver = new HandleResolver(); try {//from w w w. ja v a 2 s .c o m AdminRecord admin = new AdminRecord(authHandle.getBytes("UTF8"), 300, true, true, true, true, true, true, true, true, true, true, true, true); int timestamp = (int) (System.currentTimeMillis() / 1000); HandleValue[] val = { new HandleValue(100, "HS_ADMIN".getBytes("UTF8"), Encoder.encodeAdminRecord(admin), HandleValue.TTL_TYPE_RELATIVE, 86400, timestamp, null, true, true, true, false), new HandleValue(1, "URL".getBytes("UTF8"), datasetUrl.getBytes(), HandleValue.TTL_TYPE_RELATIVE, 86400, timestamp, null, true, true, true, false) }; CreateHandleRequest req = new CreateHandleRequest(handle.getBytes("UTF8"), val, auth); resolver.traceMessages = true; AbstractResponse response = resolver.processRequest(req); if (response.responseCode == AbstractMessage.RC_SUCCESS) { logger.info("Success! Response: \n" + response); return null; } else { logger.log(Level.WARNING, "registerNewHandle failed"); logger.warning("Error response: \n" + response); return new Exception("registerNewHandle failed: " + response); } } catch (Throwable t) { logger.log(Level.WARNING, "registerNewHandle failed"); logger.log(Level.WARNING, "String {0}", t.toString()); logger.log(Level.WARNING, "localized message {0}", t.getLocalizedMessage()); logger.log(Level.WARNING, "cause", t.getCause()); logger.log(Level.WARNING, "message {0}", t.getMessage()); return t; } }
From source file:com.kenai.redminenb.query.RedmineQuery.java
private boolean doRefresh(final boolean autoRefresh) { // XXX what if already running! - cancel task assert !SwingUtilities.isEventDispatchThread() : "Accessing remote host. Do not call in awt"; // NOI18N final boolean ret[] = new boolean[1]; executeQuery(new Runnable() { @Override/*from w w w . j a va2 s . com*/ public void run() { Redmine.LOG.log(Level.FINE, "refresh start - {0}", name); // NOI18N try { if (delegateContainer != null) { delegateContainer.refreshingStarted(); } // keeps all issues we will retrieve from the server // - those matching the query criteria // - and the obsolete ones Set<RedmineIssue> queryIssues = new HashSet<>(); issues.clear(); // archivedIssues.clear(); if (isSaved()) { // read the stored state ... // queryIssues.addAll(repository.getIssueCache().readQueryIssues(getStoredQueryName())); // queryIssues.addAll(repository.getIssueCache().readArchivedQueryIssues(getStoredQueryName())); // ... and they might be rendered obsolete if not returned by the query // archivedIssues.addAll(queryIssues); } firstRun = false; try { List<com.taskadapter.redmineapi.bean.Issue> issueArr = doSearch( queryController.getSearchParameters()); for (com.taskadapter.redmineapi.bean.Issue issue : issueArr) { getController().addProgressUnit(RedmineIssue.getDisplayName(issue)); RedmineIssue redmineIssue = new RedmineIssue(repository, issue); issues.add(redmineIssue); if (delegateContainer != null) { delegateContainer.add(redmineIssue); } fireNotifyData(redmineIssue); // XXX - !!! triggers getIssues() } } catch (Exception e) { Exceptions.printStackTrace(e); } // only issues not returned by the query are obsolete //archivedIssues.removeAll(issues); if (isSaved()) { // ... and store all issues you got // repository.getIssueCache().storeQueryIssues(getStoredQueryName(), issues.toArray(new String[issues.size()])); //repository.getIssueCache().storeArchivedQueryIssues(getStoredQueryName(), archivedIssues.toArray(new String[0])); } // now get the task data for // - all issue returned by the query // - and issues which were returned by some previous run and are archived now queryIssues.addAll(issues); if (delegateContainer != null) { delegateContainer.refreshingFinished(); } getController().switchToDeterminateProgress(queryIssues.size()); } finally { logQueryEvent(issues.size(), autoRefresh); Redmine.LOG.log(Level.FINE, "refresh finish - {0}", name); // NOI18N } } }); return ret[0]; }
From source file:org.crank.javax.faces.component.MenuRenderer.java
public Object convertSelectManyValue(FacesContext context, UISelectMany uiSelectMany, String[] newValues) throws ConverterException { // if we have no local value, try to get the valueExpression. ValueExpression valueExpression = uiSelectMany.getValueExpression("value"); Object result = newValues; // default case, set local value Class<?> modelType = null; boolean throwException = false; // If we have a ValueExpression if (null != valueExpression) { modelType = valueExpression.getType(context.getELContext()); // Does the valueExpression resolve properly to something with // a type? if (modelType != null) { result = convertSelectManyValuesForModel(context, uiSelectMany, modelType, newValues); }//from ww w. j a v a2 s . c o m // If it could not be converted, as a fall back try the type of // the valueExpression's current value covering some edge cases such // as where the current value came from a Map. if (result == null) { Object value = valueExpression.getValue(context.getELContext()); if (value != null) { result = convertSelectManyValuesForModel(context, uiSelectMany, value.getClass(), newValues); } } if (result == null) { throwException = true; } } else { // No ValueExpression, just use Object array. result = convertSelectManyValues(context, uiSelectMany, Object[].class, newValues); } if (throwException) { StringBuffer values = new StringBuffer(); if (null != newValues) { for (int i = 0; i < newValues.length; i++) { if (i == 0) { values.append(newValues[i]); } else { values.append(' ').append(newValues[i]); } } } Object[] params = { values.toString(), valueExpression.getExpressionString() }; throw new ConverterException( MessageUtils.getExceptionMessage(MessageUtils.CONVERSION_ERROR_MESSAGE_ID, params)); } // At this point, result is ready to be set as the value if (logger.isLoggable(Level.FINE)) { logger.fine("SelectMany Component " + uiSelectMany.getId() + " convertedValues " + result); } return result; }
From source file:io.hops.hopsworks.api.user.UserService.java
@GET @Path("profile") @Produces(MediaType.APPLICATION_JSON)/*from w w w. ja v a 2 s . c o m*/ public Response getUserProfile(@Context SecurityContext sc) throws UserException { Users user = userBean.findByEmail(sc.getUserPrincipal().getName()); if (user == null) { throw new UserException(RESTCodes.UserErrorCode.USER_WAS_NOT_FOUND, Level.FINE); } UserDTO userDTO = new UserDTO(user); return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(userDTO).build(); }
From source file:org.openepics.discs.ccdb.gui.ui.AuditManager.java
private String formatEntryDetails(AuditRecord record) { try {/*from w ww.ja v a 2 s. c o m*/ final ObjectMapper mapper = new ObjectMapper(); final Object json = mapper.readValue(record.getEntry(), Object.class); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(json); } catch (IOException e) { LOGGER.log(Level.FINE, e.getMessage(), e); return ""; } }
From source file:com.hello2morrow.sonargraph.jenkinsplugin.controller.SonargraphChartAction.java
/** * Method that generates the chart and adds it to the response object to allow jenkins to display it. * It is called in SonargraphChartAction/index.jelly in the src attribute of an img tag. *///from w w w.ja v a 2s . co m public void doGetPlot(StaplerRequest req, StaplerResponse rsp) { @SuppressWarnings("unchecked") Map<String, String[]> parameterMap = (Map<String, String[]>) req.getParameterMap(); String metricName = StaplerRequestUtil.getSimpleValue(METRIC_PARAMETER, parameterMap); if (metricName == null) { SonargraphLogger.INSTANCE.log(Level.SEVERE, "No metric specified for creating a plot."); return; } SonargraphMetrics metric = null; try { metric = SonargraphMetrics.fromStandardName(metricName); } catch (IllegalArgumentException ex) { SonargraphLogger.INSTANCE.log(Level.SEVERE, "Specified metric '" + metricName + "' is not supported."); return; } File csvFile = new File(project.getRootDir(), ConfigParameters.METRIC_HISTORY_CSV_FILE_PATH.getValue()); SonargraphLogger.INSTANCE.log(Level.FINE, "Generating chart for metric '" + metricName + "'. Reading values from '" + csvFile.getAbsolutePath() + "'"); IMetricHistoryProvider csvFileHandler = new CSVFileHandler(csvFile); String type = StaplerRequestUtil.getSimpleValue(TYPE_PARAMETER, parameterMap); AbstractPlot plot = null; String xAxisLabel = null; int maxDataPoints = 0; if ((type == null) || type.equals(SHORT_TERM)) { plot = new XYLineAndShapePlot(csvFileHandler); xAxisLabel = BUILD; maxDataPoints = MAX_DATA_POINTS_SHORT_TERM; } else if (type.equals(LONG_TERM)) { plot = new TimeSeriesPlot(csvFileHandler, MAX_DATA_POINTS_SHORT_TERM); xAxisLabel = DATE; maxDataPoints = MAX_DATA_POINTS_LONG_TERM; } else { SonargraphLogger.INSTANCE.log(Level.SEVERE, "Chart type '" + type + "' is not supported!"); return; } final JFreeChart chart = plot.createXYChart(metric, xAxisLabel, maxDataPoints, true); try { Graph graph = new Graph(plot.getTimestampOfLastDisplayedPoint(), defaultGraphicWidth, defaultGraphicHeight) { @Override protected JFreeChart createGraph() { return chart; } }; graph.doPng(req, rsp); } catch (IOException ioe) { SonargraphLogger.INSTANCE.log(Level.SEVERE, "Error generating the graphic for metric '" + metric.getStandardName() + "'"); } }
From source file:com.cyberway.issue.crawler.datamodel.ServerCache.java
protected CrawlHost createHostFor(String hostname) { if (hostname == null || hostname.length() == 0) { return null; }// w ww . j av a2 s . co m CrawlHost host = (CrawlHost) this.hosts.get(hostname); if (host != null) { return host; } String hkey = new String(hostname); host = new CrawlHost(hkey); this.hosts.put(hkey, host); if (logger.isLoggable(Level.FINE)) { logger.fine("Created host " + hostname); } return host; }
From source file:org.jax.maanova.plot.SaveChartAction.java
/** * {@inheritDoc}//from w ww.jav a 2 s.co m */ public void actionPerformed(ActionEvent e) { JFreeChart myChart = this.chart; Dimension mySize = this.size; if (myChart == null || mySize == null) { LOG.severe("Failed to save graph image because of a null value"); MessageDialogUtilities.errorLater(Maanova.getInstance().getApplicationFrame(), "Internal error: Failed to save graph image.", "Image Save Failed"); } else { // use the remembered starting dir MaanovaApplicationConfigurationManager configurationManager = MaanovaApplicationConfigurationManager .getInstance(); JMaanovaApplicationState applicationState = configurationManager.getApplicationState(); FileType rememberedJaxbImageDir = applicationState.getRecentImageExportDirectory(); File rememberedImageDir = null; if (rememberedJaxbImageDir != null && rememberedJaxbImageDir.getFileName() != null) { rememberedImageDir = new File(rememberedJaxbImageDir.getFileName()); } // select the image file to save JFileChooser fileChooser = new JFileChooser(rememberedImageDir); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setApproveButtonText("Save Graph"); fileChooser.setDialogTitle("Save Graph as Image"); fileChooser.setMultiSelectionEnabled(false); fileChooser.addChoosableFileFilter(PngFileFilter.getInstance()); fileChooser.setFileFilter(PngFileFilter.getInstance()); int response = fileChooser.showSaveDialog(Maanova.getInstance().getApplicationFrame()); if (response == JFileChooser.APPROVE_OPTION) { File selectedFile = fileChooser.getSelectedFile(); // tack on the extension if there isn't one // already if (!PngFileFilter.getInstance().accept(selectedFile)) { String newFileName = selectedFile.getName() + "." + PngFileFilter.PNG_EXTENSION; selectedFile = new File(selectedFile.getParentFile(), newFileName); } if (selectedFile.exists()) { // ask the user if they're sure they want to overwrite String message = "Exporting the graph image to " + selectedFile.getAbsolutePath() + " will overwrite an " + " existing file. Would you like to continue anyway?"; if (LOG.isLoggable(Level.FINE)) { LOG.fine(message); } boolean overwriteOk = MessageDialogUtilities .confirmOverwrite(Maanova.getInstance().getApplicationFrame(), selectedFile); if (!overwriteOk) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("overwrite canceled"); } return; } } try { ChartUtilities.saveChartAsPNG(selectedFile, myChart, mySize.width, mySize.height); File parentDir = selectedFile.getParentFile(); if (parentDir != null) { // update the "recent image directory" ObjectFactory objectFactory = new ObjectFactory(); FileType latestJaxbImageDir = objectFactory.createFileType(); latestJaxbImageDir.setFileName(parentDir.getAbsolutePath()); applicationState.setRecentImageExportDirectory(latestJaxbImageDir); } } catch (Exception ex) { LOG.log(Level.SEVERE, "failed to save graph image", ex); } } } }
From source file:org.camunda.bpm.elasticsearch.index.ElasticSearchDefaultIndexStrategy.java
protected UpdateRequestBuilder prepareUpdateRequest(HistoryEvent historyEvent) throws IOException { UpdateRequestBuilder updateRequestBuilder = esClient.prepareUpdate() .setIndex(dispatcher.getDispatchTargetIndex(historyEvent)) .setId(historyEvent.getProcessInstanceId()); String dispatchTargetType = dispatcher.getDispatchTargetType(historyEvent); if (dispatchTargetType != null && !dispatchTargetType.isEmpty()) { updateRequestBuilder.setType(dispatchTargetType); }//w w w . j av a2s . c o m if (historyEvent instanceof HistoricProcessInstanceEventEntity) { prepareHistoricProcessInstanceEventUpdate(historyEvent, updateRequestBuilder); } else if (historyEvent instanceof HistoricActivityInstanceEventEntity || historyEvent instanceof HistoricTaskInstanceEventEntity || historyEvent instanceof HistoricVariableUpdateEventEntity) { updateRequestBuilder = prepareOtherHistoricEventsUpdateRequest(historyEvent, updateRequestBuilder); } else { // unknown event - insert... throw new IllegalArgumentException("Unknown event detected: '" + historyEvent + "'"); // LOGGER.warning("Unknown event detected: '" + historyEvent + "'"); } if (LOGGER.isLoggable(Level.FINE)) { updateRequestBuilder.setFields("_source"); } return updateRequestBuilder; }