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:eu.trentorise.opendata.josman.Josmans.java

/**
 * Fetches all tags from a github repository. Beware of API limits of 60
 * requests per hour//from  w  w w  .ja  va2 s  . c o  m
 */
public static ImmutableList<RepositoryTag> fetchTags(String organization, String repoName) {
    TodUtils.checkNotEmpty(organization, "Invalid organization!");
    TodUtils.checkNotEmpty(repoName, "Invalid repo name!");

    LOG.log(Level.FINE, "Fetching {0}/{1} tags.", new Object[] { organization, repoName });

    try {
        GitHubClient client = new GitHubClient();
        RepositoryService service = new RepositoryService(client);
        Repository repo = service.getRepository(organization, repoName);
        List<RepositoryTag> tags = service.getTags(repo);
        return ImmutableList.copyOf(tags);
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }

}

From source file:it.geosolutions.geoserver.jms.client.JMSQueueListener.java

@Override
public void onMessage(Message message, Session session) throws JMSException {

    if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.fine("Incoming message event for session: " + session.toString());
    }//w ww  . j a v a 2  s.  co m

    // CHECKING LISTENER STATUS
    if (!isEnabled()) {
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("Incoming message is swallowed since this component is disabled");
        }
        return;
    }
    // FILTERING INCOMING MESSAGE
    if (!message.propertyExists(JMSConfiguration.INSTANCE_NAME_KEY)) {
        throw new JMSException("Unable to handle incoming message, property \'"
                + JMSConfiguration.INSTANCE_NAME_KEY + "\' not set.");
    }

    // FILTERING INCOMING MESSAGE
    if (!message.propertyExists(JMSConfiguration.GROUP_KEY)) {
        throw new JMSException(
                "Unable to handle incoming message, property \'" + JMSConfiguration.GROUP_KEY + "\' not set.");
    }

    // check if message comes from a master with the same name of this slave
    if (message.getStringProperty(JMSConfiguration.INSTANCE_NAME_KEY)
            .equals(config.getConfiguration(JMSConfiguration.INSTANCE_NAME_KEY))) {
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("Incoming message discarded: source is equal to destination");
        }
        // if so discard the message
        return;
    }

    // check if message comes from a different group
    final String group = message.getStringProperty(JMSConfiguration.GROUP_KEY);
    final String localGroup = config.getConfiguration(JMSConfiguration.GROUP_KEY);
    if (!group.equals(localGroup)) {
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("Incoming message discarded: incoming group-->" + group
                    + " is different from the local one-->" + localGroup);
        }
        // if so discard the message
        return;
    }

    // check the property which define the SPI used (to serialize on the
    // server side).
    if (!message.propertyExists(JMSEventHandlerSPI.getKeyName()))
        throw new JMSException("Unable to handle incoming message, property \'"
                + JMSEventHandlerSPI.getKeyName() + "\' not set.");

    // END -> FILTERING INCOMING MESSAGE

    // get the name of the SPI used to serialize the message
    final String generatorClass = message.getStringProperty(JMSEventHandlerSPI.getKeyName());
    if (generatorClass == null || generatorClass.isEmpty()) {
        throw new IllegalArgumentException("Unable to handle a message without a generator class name");
    }
    if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.fine(
                "Incoming message was serialized using an handler generated by: \'" + generatorClass + "\'");
    }

    // USING INCOMING MESSAGE
    if (message instanceof ObjectMessage) {

        final ObjectMessage objMessage = (ObjectMessage) (message);
        final Serializable obj = objMessage.getObject();

        try {
            // lookup the SPI handler, search is performed using the
            // name
            final JMSEventHandler<Serializable, Object> handler = jmsManager
                    .getHandlerByClassName(generatorClass);
            if (handler == null) {
                throw new JMSException("Unable to find SPI named \'" + generatorClass
                        + "\', be shure to load that SPI into your context.");
            }

            final Enumeration<String> keys = message.getPropertyNames();
            final Properties options = new Properties();
            while (keys.hasMoreElements()) {
                String key = keys.nextElement();
                options.put(key, message.getObjectProperty(key));
            }
            handler.setProperties(options);

            // try to synchronize object locally
            if (!handler.synchronize(handler.deserialize(obj))) {
                throw new JMSException("Unable to synchronize message locally.\n SPI: " + generatorClass);
            }

        } catch (Exception e) {
            final JMSException jmsE = new JMSException(e.getLocalizedMessage());
            jmsE.initCause(e);
            throw jmsE;
        }

    } else
        throw new JMSException("Unrecognized message type for catalog incoming event");
}

From source file:com.stratuscom.harvester.ProfileConfigReader.java

private ContainerConfig readProfileConfig()
        throws SAXException, JAXBException, FileNotFoundException, IOException {
    Unmarshaller um = Bootstrap.createConfigUnmarshaller();
    FileObject profileDir = fileUtility.getProfileDirectory();
    FileObject configFile = profileDir.resolveFile(Strings.CONFIG_XML);
    log.log(Level.FINE, MessageNames.CONFIG_FILE, configFile.toString());
    InputStream is = configFile.getContent().getInputStream();
    ContainerConfig containerConfig = (ContainerConfig) um.unmarshal(is);
    return containerConfig;
}

From source file:com.hellblazer.process.impl.AbstractManagedProcess.java

public static UUID getIdFrom(File homeDirectory) {
    if (!homeDirectory.exists() || !homeDirectory.isDirectory()) {
        return null;
    }/*  www .  j  av  a  2 s . c  o m*/
    File[] contents = homeDirectory.listFiles(new FilenameFilter() {
        @Override
        public boolean accept(File dir, String name) {
            return name.startsWith(CONTROL_DIR_PREFIX);
        }
    });
    if (contents == null || contents.length == 0) {
        if (log.isLoggable(Level.FINE)) {
            log.fine("Home directory does not exist or does not contain a valid control directory: "
                    + homeDirectory.getAbsolutePath());
        }
        return null;
    }
    if (contents.length > 1) {
        if (log.isLoggable(Level.FINE)) {
            log.fine("Home directory contains more than a single control directory: "
                    + homeDirectory.getAbsolutePath());
        }
        return null;
    }
    String uuidString = contents[0].getName().substring(CONTROL_DIR_PREFIX.length());
    if (uuidString.length() == 0) {
        if (log.isLoggable(Level.FINE)) {
            log.fine("Home directory does not contain a valid control directory: "
                    + homeDirectory.getAbsolutePath());
        }
        return null;
    }
    return UUID.fromString(uuidString);
}

From source file:com.joyfulmongo.db.javadriver.JFDBUtil.java

public static JSONObject toJSONObject(DBObject o) {
    JSONObject result = new JSONObject();

    try {//from w w  w  . jav  a 2  s  .co  m
        Iterator<String> i = o.keySet().iterator();
        while (i.hasNext()) {
            String k = (String) i.next();
            Object v = o.get(k);
            if (LOGGER.isLoggable(Level.FINE)) {
                LOGGER.log(Level.FINE, "toJSON Key=[" + k + "]=[" + v + "] " + v.getClass());
            }

            if (v instanceof BasicDBList) {
                result.put(k, toJSONArray((BasicDBList) v));
            } else if (v instanceof DBObject) {
                DBObject dv = (DBObject) v;
                String op = (String) dv.get("__op");
                if (op != null) {
                    Object objs = dv.get("objects");
                    if (objs == null) {
                        // ignore
                    } else if (objs instanceof BasicDBList) {
                        JSONArray jarray = toJSONArray((BasicDBList) objs);
                        result.put(k, jarray);
                    } else {
                        result.put(k, toJSONObject((DBObject) objs));
                    }
                } else {
                    result.put(k, toJSONObject((DBObject) v));
                }
            } else if (v instanceof ObjectId) {
                // ignore the mongo objectId;
            } else if (v instanceof Date) {
                DateFormat format = Utils.getParseDateFormat();
                result.put(k, format.format((Date) v));
            } else {
                result.put(k, v);
            }
        }
        return result;
    } catch (JSONException je) {
        return null;
    }
}

From source file:net.sourceforge.hypo.inject.resolver.NamedSpringBeanResolver.java

/**
 * Performs injection by looking up the Spring ApplicationContext to find the single bean
 * which has the name specified by the InjectionMember 
 * @param dep the Dependency to be injected
 * @param target the object which is to have the member injected
 * @return true if a bean with the required name existed in the context; false if no suitable 
 * bean was found//  w w w  .  ja v a2s.c o  m
 */
public ResolutionResult doResolve(Dependency dep, Object target) {
    String name = dep.getAssociatedName();

    try {
        Object bean = applicationContext.getBean(name, dep.getType());
        if (log.isLoggable(Level.FINE))
            log.fine("Found bean named \"" + name + "\" to inject for dependency " + dep + ".");
        return ResolutionResult.resolved(bean);
    } catch (NoSuchBeanDefinitionException nsbe) {
        //Drop out with "could not resolve" result
    }
    return ResolutionResult.couldNotResolve();
}

From source file:net.chrissearle.flickrvote.web.ShowChallengeAction.java

public String execute() throws Exception {
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("Challenge ID " + challengeTag);
    }/* www  .  ja  va2s .co  m*/

    ChallengeSummary challengeSummary = challengeService.getChallengeSummary(challengeTag);

    if (logger.isLoggable(Level.FINE)) {
        logger.fine("Challenge " + challengeSummary);
    }

    if (challengeSummary != null) {
        challenge = new DisplayChallengeSummary(challengeSummary);

        ChallengeItem challengeItem = photographyService.getChallengeImages(challengeSummary.getTag());

        images = new ArrayList<DisplayImage>(challengeItem.getImages().size());

        for (ImageItem image : challengeItem.getImages()) {
            images.add(new DisplayImage(image));
        }

        Collections.sort(images, new Comparator<DisplayImage>() {
            public int compare(DisplayImage o1, DisplayImage o2) {
                return o2.getVoteCount().compareTo(o1.getVoteCount());
            }
        });
    }

    return ActionSupport.SUCCESS;
}

From source file:io.fabric8.cxf.endpoint.BeanValidationAnnotationIntrospector.java

@Override
public boolean hasIgnoreMarker(AnnotatedMember m) {
    Member member = m.getMember();
    int modifiers = member.getModifiers();
    if (Modifier.isTransient(modifiers)) {
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Ignoring transient member " + m);
        }/*w  ww .j av a 2s . com*/
        return true;
    } else if (m instanceof AnnotatedMethod) {
        AnnotatedMethod method = (AnnotatedMethod) m;
        String methodName = method.getName();
        // lets see if there is a transient field of the same name as the getter
        if (methodName.startsWith("get") && method.getParameterCount() == 0) {
            String fieldName = Introspector.decapitalize(methodName.substring(3));
            Class<?> declaringClass = method.getDeclaringClass();
            Field field = findField(fieldName, declaringClass);
            if (field != null) {
                int fieldModifiers = field.getModifiers();
                if (Modifier.isTransient(fieldModifiers)) {
                    LOG.fine("Ignoring member " + m + " due to transient field called " + fieldName);
                    return true;
                }
            }
        }
    }
    return super.hasIgnoreMarker(m);

}

From source file:org.openspaces.rest.space.SpacePojoReadAPIController.java

/**
 * REST ReadMultiple by query request handler - readMultiple
 * //www .j  a  v a  2s . co m
 */
@RequestMapping(value = "/readMultiple", method = RequestMethod.GET)
public ModelAndView readMultiple(@RequestParam String spaceName, @RequestParam String locators,
        @RequestParam String classname, @RequestParam Integer max, @RequestParam String query,
        HttpServletResponse response) {
    if (logger.isLoggable(Level.FINE))
        logger.fine("creating read query with type: " + classname + " and query=" + query);

    Object template;
    try {
        template = Class.forName(classname).newInstance();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    Object[] objs = null;
    if (max == null)
        max = Integer.MAX_VALUE;

    GigaSpace gigaSpace = ControllerUtils.xapCache.get(spaceName, locators);

    if (query == null || query.length() == 0) {
        objs = gigaSpace.readMultiple(template, max);
    } else {
        objs = gigaSpace.readMultiple(new SQLQuery(template.getClass(), query), max);
    }

    ModelAndView mv = new ModelAndView("jsonView");
    if (objs != null) {
        int i = 0;
        for (Object obj : objs) {
            i++;
            mv.addObject(String.valueOf(i), obj);
        }
    }
    response.setHeader("Access-Control-Allow-Origin", "*");
    return mv;
}

From source file:net.chrissearle.flickrvote.web.admin.ScoreAction.java

@Override
public String input() throws Exception {
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("Challenge ID " + tag);
    }//from w  w w. ja v  a 2  s . c  o  m

    ChallengeSummary challengeSummary = challengeService.getChallengeSummary(tag);

    if (logger.isLoggable(Level.FINE)) {
        logger.fine("Challenge " + challengeSummary);
    }

    if (challengeSummary != null) {
        challenge = new DisplayChallengeSummary(challengeSummary);

        ChallengeItem challengeItem = photographyService.getChallengeImages(challengeSummary.getTag());

        scores = new ArrayList<ScoreAdmin>(challengeItem.getImages().size());

        for (ImageItem image : challengeItem.getImages()) {
            scores.add(new ScoreAdmin(image));
        }

        Collections.sort(scores, new Comparator<ScoreAdmin>() {
            public int compare(ScoreAdmin o1, ScoreAdmin o2) {
                return o2.getScore().compareTo(o1.getScore());
            }
        });
    }

    return INPUT;
}