Example usage for java.util.logging Level FINE

List of usage examples for java.util.logging Level FINE

Introduction

In this page you can find the example usage for java.util.logging Level FINE.

Prototype

Level FINE

To view the source code for java.util.logging Level FINE.

Click Source Link

Document

FINE is a message level providing tracing information.

Usage

From source file:com.google.api.server.spi.request.ServletRequestParamReader.java

protected Object[] deserializeParams(JsonNode node) throws IOException, IllegalAccessException,
        InvocationTargetException, NoSuchMethodException, ServiceException {
    EndpointMethod method = getMethod();
    Class<?>[] paramClasses = method.getParameterClasses();
    TypeToken<?>[] paramTypes = method.getParameterTypes();
    Object[] params = new Object[paramClasses.length];
    List<String> parameterNames = getParameterNames(method);
    for (int i = 0; i < paramClasses.length; i++) {
        TypeToken<?> type = paramTypes[i];
        Class<?> clazz = paramClasses[i];
        if (User.class.isAssignableFrom(clazz)) {
            // User type parameter requires no Named annotation (ignored if present)
            User user = getUser();/* w w w .  j  a  v a  2 s.c  o m*/
            if (user == null || clazz.isAssignableFrom(user.getClass())) {
                params[i] = user;
                logger.log(Level.FINE, "deserialize: User injected into param[{0}]", i);
            } else {
                logger.log(Level.WARNING,
                        "deserialize: User object of type {0} is not assignable to {1}. User will be null.",
                        new Object[] { user.getClass().getName(), clazz.getName() });
            }
        } else if (APPENGINE_USER_CLASS_NAME.equals(clazz.getName())) {
            // User type parameter requires no Named annotation (ignored if present)
            params[i] = getAppEngineUser();
            logger.log(Level.FINE, "deserialize: App Engine User injected into param[{0}]", i);
        } else if (clazz == HttpServletRequest.class) {
            // HttpServletRequest type parameter requires no Named annotation (ignored if present)
            params[i] = servletRequest;
            logger.log(Level.FINE, "deserialize: HttpServletRequest injected into param[{0}]", i);
        } else if (clazz == ServletContext.class) {
            // ServletContext type parameter requires no Named annotation (ignored if present)
            params[i] = servletContext;
            logger.log(Level.FINE, "deserialize: ServletContext {0} injected into param[{1}]",
                    new Object[] { params[i], i });
        } else {
            String name = parameterNames.get(i);
            if (Strings.isNullOrEmpty(name)) {
                params[i] = (node == null) ? null : objectReader.forType(clazz).readValue(node);
                logger.log(Level.FINE, "deserialize: {0} {1} injected into unnamed param[{2}]",
                        new Object[] { clazz, params[i], i });
            } else if (StandardParameters.isStandardParamName(name)) {
                params[i] = getStandardParamValue(node, name);
            } else {
                JsonNode nodeValue = node.get(name);
                if (nodeValue == null) {
                    params[i] = null;
                } else {
                    // Check for collection type
                    if (Collection.class.isAssignableFrom(clazz)
                            && type.getType() instanceof ParameterizedType) {
                        params[i] = deserializeCollection(clazz, (ParameterizedType) type.getType(), nodeValue);
                    } else {
                        params[i] = objectReader.forType(clazz).readValue(nodeValue);
                    }
                }
                logger.log(Level.FINE, "deserialize: {0} {1} injected into param[{2}] named {3}",
                        new Object[] { clazz, params[i], i, name });
            }
        }
    }
    return params;
}

From source file:com.ibm.iotf.devicemgmt.device.ManagedDevice.java

/**
 * Constructor that creates a ManagedDevice object, but does not connect to
 * IBM Watson IoT Platform connect yet/*from w w w . j a  va  2  s  .  c  o m*/
 *
 * @param options      List of options to connect to IBM Watson IoT Platform Connect
 * @param deviceData   The Device Model
 * @throws Exception   If the essential parameters are not set
 */
public ManagedDevice(Properties options, DeviceData deviceData) throws Exception {
    super(options);
    final String METHOD = "constructor";
    if (deviceData == null) {
        LoggerUtility.log(Level.FINE, CLASS_NAME, METHOD,
                "Could not create Managed Client " + "without DeviceInformations !");
        throw new Exception("Could not create Managed Client without DeviceInformations !");
    }
    String typeId = this.getDeviceType();
    String deviceId = this.getDeviceId();

    if (typeId == null || deviceId == null) {
        LoggerUtility.log(Level.FINE, CLASS_NAME, METHOD,
                "Could not create Managed Client " + "without Device Type or Device ID !");
        throw new Exception("Could not create Managed Client without Device Type or Device ID!, "
                + "Please specify the same in properties");
    }
    deviceData.setTypeId(typeId);
    deviceData.setDeviceId(deviceId);
    this.deviceData = deviceData;
    this.client = new ManagedDeviceClient(this);
}

From source file:it.geosolutions.imageio.plugins.nitronitf.NITFImageWriter.java

/**
 * Setup all the header fields taking them from the wrapper
 * /*from w  ww.  j av a 2s.c  o m*/
 * @param record
 * @param headerWrapper
 * @throws NITFException
 */
private static void initFileHeader(Record record, HeaderWrapper headerWrapper) throws NITFException {
    if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.log(Level.FINE, "Populating file header");
    }
    final FileHeader header = record.getHeader();
    NITFUtilities.setField("FHDR", header.getFileHeader(), NITFUtilities.Consts.DEFAULT_FILE_HEADER);
    NITFUtilities.setField("FVER", header.getFileVersion(), NITFUtilities.Consts.DEFAULT_FILE_VERSION);
    NITFUtilities.setField("STYPE", header.getSystemType(), NITFUtilities.Consts.DEFAULT_SYSTEM_TYPE);
    if (headerWrapper != null) {
        NITFUtilities.setField("OSTAID", header.getOriginStationID(), headerWrapper.getOriginStationId());
        NITFUtilities.setField("FDT", header.getFileDateTime(), headerWrapper.getDateTime());
        NITFUtilities.setField("FTITLE", header.getFileTitle(), headerWrapper.getTitle());
        NITFUtilities.setField("FSCLSY", header.getSecurityGroup().getClassificationSystem(),
                headerWrapper.getSecurityClassificationSystem());
        NITFUtilities.setField("ENCRYP", header.getEncrypted(), Integer.toString(headerWrapper.getEncrypted()));
        header.getClassification().setData(headerWrapper.getSecurityClassificationSystem());
        NITFUtilities.setField("FBKGC", header.getBackgroundColor(), headerWrapper.getBackgroundColor());
        NITFUtilities.setField("ONAME", header.getOriginatorName(), headerWrapper.getOriginatorName());
        NITFUtilities.setField("OPHONE", header.getOriginatorPhone(), headerWrapper.getOriginatorPhone());
    }

    if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.log(Level.FINE, "file header has been setup");
    }

    // Setting main header TREs if any
    Map<String, Map<String, String>> tresMap = headerWrapper.getTres();
    if (tresMap != null && !tresMap.isEmpty()) {
        Extensions extendedSection = header.getExtendedSection();
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, "Populating Main Header TREs");
        }

        Set<String> keys = tresMap.keySet();
        Iterator<String> it = keys.iterator();
        while (it.hasNext()) {
            String treName = it.next();
            Map<String, String> fieldsMapping = tresMap.get(treName);
            TRE tre = setTRE(treName, fieldsMapping);
            extendedSection.appendTRE(tre);
        }
    }
}

From source file:com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger.java

/**
 * {@inheritDoc}//from   w  w w .  jav a2s  .  c  o  m
 */
@Override
public void run() {
    if (job == null) {
        return;
    }
    long now = System.currentTimeMillis();
    FolderComputation<?> computation = job.getComputation();
    if (computation != null) {
        long delay = now - computation.getTimestamp().getTimeInMillis();
        if (delay < interval) {
            LOGGER.log(Level.FINE, "Too early to reschedule {0} based on last computation", job);
            return;
        }
    }
    if (now - lastTriggered < interval) {
        LOGGER.log(Level.FINE, "Too early to reschedule {0} based on last triggering", job);
        return;
    }
    if (job.scheduleBuild(0, new TimerTrigger.TimerTriggerCause())) {
        lastTriggered = now;
    } else {
        LOGGER.log(Level.WARNING, "Queue refused to schedule {0}", job);
    }
}

From source file:edu.uci.ics.hyracks.api.client.impl.ActivityClusterGraphBuilder.java

public ActivityClusterGraph inferActivityClusters(JobId jobId, JobActivityGraph jag) {
    /*//from   w w  w.j  av  a2  s  .c o m
     * Build initial equivalence sets map. We create a map such that for each IOperatorTask, t -> { t }
     */
    Map<ActivityId, Set<ActivityId>> stageMap = new HashMap<ActivityId, Set<ActivityId>>();
    Set<Set<ActivityId>> stages = new HashSet<Set<ActivityId>>();
    for (ActivityId taskId : jag.getActivityMap().keySet()) {
        Set<ActivityId> eqSet = new HashSet<ActivityId>();
        eqSet.add(taskId);
        stageMap.put(taskId, eqSet);
        stages.add(eqSet);
    }

    boolean changed = true;
    while (changed) {
        changed = false;
        Pair<ActivityId, ActivityId> pair = findMergePair(jag, stages);
        if (pair != null) {
            merge(stageMap, stages, pair.getLeft(), pair.getRight());
            changed = true;
        }
    }

    ActivityClusterGraph acg = new ActivityClusterGraph();
    Map<ActivityId, ActivityCluster> acMap = new HashMap<ActivityId, ActivityCluster>();
    int acCounter = 0;
    Map<ActivityId, IActivity> activityNodeMap = jag.getActivityMap();
    List<ActivityCluster> acList = new ArrayList<ActivityCluster>();
    for (Set<ActivityId> stage : stages) {
        ActivityCluster ac = new ActivityCluster(acg, new ActivityClusterId(jobId, acCounter++));
        acList.add(ac);
        for (ActivityId aid : stage) {
            IActivity activity = activityNodeMap.get(aid);
            ac.addActivity(activity);
            acMap.put(aid, ac);
        }
    }

    for (Set<ActivityId> stage : stages) {
        for (ActivityId aid : stage) {
            IActivity activity = activityNodeMap.get(aid);
            ActivityCluster ac = acMap.get(aid);
            List<IConnectorDescriptor> aOutputs = jag.getActivityOutputMap().get(aid);
            if (aOutputs == null || aOutputs.isEmpty()) {
                ac.addRoot(activity);
            } else {
                int nActivityOutputs = aOutputs.size();
                for (int i = 0; i < nActivityOutputs; ++i) {
                    IConnectorDescriptor conn = aOutputs.get(i);
                    ac.addConnector(conn);
                    Pair<Pair<IActivity, Integer>, Pair<IActivity, Integer>> pcPair = jag
                            .getConnectorActivityMap().get(conn.getConnectorId());
                    ac.connect(conn, activity, i, pcPair.getRight().getLeft(), pcPair.getRight().getRight(),
                            jag.getConnectorRecordDescriptorMap().get(conn.getConnectorId()));
                }
            }
        }
    }

    Map<ActivityId, Set<ActivityId>> blocked2BlockerMap = jag.getBlocked2BlockerMap();
    for (ActivityCluster s : acList) {
        Map<ActivityId, Set<ActivityId>> acBlocked2BlockerMap = s.getBlocked2BlockerMap();
        Set<ActivityCluster> blockerStages = new HashSet<ActivityCluster>();
        for (ActivityId t : s.getActivityMap().keySet()) {
            Set<ActivityId> blockerTasks = blocked2BlockerMap.get(t);
            acBlocked2BlockerMap.put(t, blockerTasks);
            if (blockerTasks != null) {
                for (ActivityId bt : blockerTasks) {
                    blockerStages.add(acMap.get(bt));
                }
            }
        }
        for (ActivityCluster bs : blockerStages) {
            s.getDependencies().add(bs);
        }
    }
    acg.addActivityClusters(acList);

    if (LOGGER.isLoggable(Level.FINE)) {
        try {
            LOGGER.fine(acg.toJSON().toString(2));
        } catch (JSONException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }
    return acg;
}

From source file:be.appfoundry.custom.google.android.gcm.server.Sender.java

/**
 * Sends a message to one device, retrying in case of unavailability.
 * <p/>/*from   w  w  w .  j  a v a2 s .  c  o m*/
 * <p/>
 * <strong>Note: </strong> this method uses exponential back-off to retry in
 * case of service unavailability and hence could block the calling thread
 * for many seconds.
 *
 * @param message message to be sent, including the device's registration id.
 * @param to      registration token, notification key, or topic where the message will be sent.
 * @param retries number of retries in case of service unavailability errors.
 * @return result of the request (see its javadoc for more details).
 * @throws IllegalArgumentException if to is {@literal null}.
 * @throws InvalidRequestException  if GCM didn't returned a 200 or 5xx status.
 * @throws IOException              if message could not be sent.
 */
public Result send(Message message, String to, int retries) throws IOException {
    int attempt = 0;
    Result result;
    int backoff = BACKOFF_INITIAL_DELAY;
    boolean tryAgain;
    do {
        attempt++;
        if (logger.isLoggable(Level.FINE)) {
            logger.fine("Attempt #" + attempt + " to send message " + message + " to regIds " + to);
        }
        result = sendNoRetry(message, to);
        tryAgain = result == null && attempt <= retries;
        if (tryAgain) {
            int sleepTime = backoff / 2 + random.nextInt(backoff);
            sleep(sleepTime);
            if (2 * backoff < MAX_BACKOFF_DELAY) {
                backoff *= 2;
            }
        }
    } while (tryAgain);
    if (result == null) {
        throw new IOException("Could not send message after " + attempt + " attempts");
    }
    return result;
}

From source file:alien4cloud.paas.cloudify2.rest.external.RestClientExecutor.java

/**
 *
 * @param relativeUrl//  ww  w  . ja va  2 s .  c om
 *            The URL to send the get request to.
 * @param responseTypeReference
 *            The type reference of the response.
 * @param <T> The type of the response.
 * @return The response object from the REST server.
 * @throws RestClientException .
 */
public <T> T get(final String relativeUrl, final TypeReference<Response<T>> responseTypeReference)
        throws RestClientException {
    String fullUrl = getFullUrl(relativeUrl);
    final HttpGet getRequest = new HttpGet(fullUrl);
    if (logger.isLoggable(Level.FINE)) {
        logger.log(Level.FINE, "execute get request to " + relativeUrl);
    }
    return executeRequest(getRequest, responseTypeReference);
}

From source file:org.deviceconnect.message.http.impl.factory.AbstractHttpMessageFactory.java

/**
 * HTTP???dConnect???.//from w  ww  .  ja  va2  s  . com
 * @param dmessage dConnect
 * @param message HTTP
 */
protected void parseHttpBody(final DConnectMessage dmessage, final M message) {
    mLogger.entering(getClass().getName(), "newDConnectMessage", new Object[] { dmessage, message });

    HttpEntity entity = getHttpEntity(message);
    if (entity != null) {

        MimeStreamParser parser = new MimeStreamParser(new MimeEntityConfig());
        MultipartContentHandler handler = new MultipartContentHandler(dmessage);
        parser.setContentHandler(handler);

        StringBuilder headerBuffer = new StringBuilder();

        for (Header header : message.getAllHeaders()) {
            headerBuffer.append(header.getName());
            headerBuffer.append(": ");
            headerBuffer.append(header.getValue());
            headerBuffer.append(Character.toChars(HTTP.CR));
            headerBuffer.append(Character.toChars(HTTP.LF));
            mLogger.fine("header: " + header.getName() + ":" + header.getValue());
        }
        headerBuffer.append(Character.toChars(HTTP.CR));
        headerBuffer.append(Character.toChars(HTTP.LF));

        try {
            parser.parse(new SequenceInputStream(
                    new ByteArrayInputStream(headerBuffer.toString().getBytes("US-ASCII")),
                    entity.getContent()));
        } catch (IllegalStateException e) {
            mLogger.log(Level.FINE, e.toString(), e);
            mLogger.warning(e.toString());
        } catch (MimeException e) {
            mLogger.log(Level.FINE, e.toString(), e);
            mLogger.warning(e.toString());
        } catch (IOException e) {
            mLogger.log(Level.FINE, e.toString(), e);
            mLogger.warning(e.toString());
        }
    }

    mLogger.exiting(getClass().getName(), "newDConnectMessage");
}

From source file:es.itecban.deployment.executionmanager.gui.swf.service.DeletePlanCreationManager.java

public void findTargetContainers(RequestContext context) throws Exception {

    DeploymentTargetType environment = null;
    String lock = "findTargetcontainers_lock";
    synchronized (lock) {
        String environmentName = (String) context.getFlowScope().get(Constants.FLOW_SELECTED_ENV);
        String unitName = (String) context.getFlowScope().get(Constants.FLOW_SELECTED_UNIT_NAME);
        String unitVersion = (String) context.getFlowScope().get(Constants.FLOW_SELECTED_UNIT_VERSION);
        try {/*from   w  w w  .  j  av  a  2 s . c o  m*/
            Calendar cal1 = Calendar.getInstance();
            logger.info("Updating the environment information...");
            environment = envManager.updateEnvironment(environmentName);
            Calendar cal2 = Calendar.getInstance();
            Utils.getTimeOfExecution(cal1, cal2, "Time of updating the environment: ");
        } catch (Exception e) {
            logger.severe("Error while updating the environment information" + e);
            e.printStackTrace();
            ErrorUtils.createMessageError(context, e.getMessage(), null);
            throw new Exception();
        }
        // Get the nodes
        List<NodeType> nodes = environment.getNodes().getNode();
        // Iterate every node for the containers
        List<String> containerNames = new ArrayList<String>();
        for (Iterator<NodeType> iterator = nodes.iterator(); iterator.hasNext();) {
            NodeType node = (NodeType) iterator.next();
            // Get the names of the containers
            List<ContainerType> nodeContainers = node.getNodeContainers().getNodeContainer();
            for (Iterator<ContainerType> contIterator = nodeContainers.iterator(); contIterator.hasNext();) {
                ContainerType container = (ContainerType) contIterator.next();
                containerNames.add(container.getName());
            }
        }
        // Web context code
        String[] containerNamesArray = new String[containerNames.size()];
        containerNames.toArray(containerNamesArray);

        this.common.resolveUnit(context, environment);

        List<InstalledUnit> installedUnitList = (List<InstalledUnit>) context.getFlowScope()
                .get(Constants.FLOW_INSTALLED_UNITS);
        if (installedUnitList == null || installedUnitList.size() == 0) {
            // This an updating plan. If there is no installed units, something
            // must be incorrect
            ErrorUtils.createMessageError(context, "running.error.flow.delete.noInstalledUnit", null);
            throw new Exception();
        }

        DeploymentGroup[] depGroups = (DeploymentGroup[]) context.getFlowScope()
                .get(Constants.FLOW_DEPLOYMENT_GROUPS);
        boolean[][] candidates;
        if (depGroups != null) {
            String[] suitableContainers = null;
            candidates = new boolean[containerNamesArray.length][depGroups.length];
            for (int g = 0; g < depGroups.length; g++) {
                // the suitable containers for a unit to be deleted is
                // the containers where is already installed
                for (InstalledUnit iUnit : installedUnitList) {
                    // to be candidate to be deleted, the unit name and version must be the same
                    if (iUnit.getUnitName().equals(unitName) && iUnit.getUnitVersion().equals(unitVersion)) {
                        suitableContainers = new String[iUnit.getContainerArray().length];
                        for (int i = 0; i < iUnit.getContainerArray().length; i++) {
                            suitableContainers[i] = iUnit.getContainerArray()[i];
                        }
                    }
                }
                for (int c = 0; c < containerNamesArray.length; c++) {
                    String container = containerNamesArray[c];
                    // rellenamos la matriz comprobando si estan en los
                    // suitables ->
                    candidates[c][g] = contains(container, suitableContainers);
                    if (logger.isLoggable(Level.FINE))
                        logger.fine("" + candidates[c][g]);
                }
            }
            context.getFlowScope().put(Constants.FLOW_CONTAINERS, containerNamesArray);
            context.getFlowScope().put(Constants.FLOW_INSTALLED_UNITS, null);
            context.getFlashScope().put(Constants.FLOW_CANDIDATES, candidates);
        }
    }
    lock = null;
}