Java Code Examples for org.jfree.util.Log#info()

The following examples show how to use org.jfree.util.Log#info() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultLogModule.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Initalizes the module. This method initializes the logging system, if the
 * System.out logtarget is selected.
 *
 * @param subSystem the sub-system.
 * @throws ModuleInitializeException if an error occured.
 */
public void initialize(final SubSystem subSystem)
        throws ModuleInitializeException
{
  if (LogConfiguration.isDisableLogging())
  {
    return;
  }

  if (LogConfiguration.getLogTarget().equals
          (PrintStreamLogTarget.class.getName()))
  {
    DefaultLog.installDefaultLog();
    Log.getInstance().addTarget(new PrintStreamLogTarget());

    if ("true".equals(subSystem.getGlobalConfig().getConfigProperty
            ("org.jfree.base.LogAutoInit")))
    {
      Log.getInstance().init();
    }
    Log.info("Default log target started ... previous log messages " +
            "could have been ignored.");
  }
}
 
Example 2
Source File: AbstractBoot.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Loads the specified booter implementation.
 *
 * @param classname  the class name.
 *
 * @return The boot class.
 */
protected AbstractBoot loadBooter(final String classname) {
    if (classname == null) {
        return null;
    }
    try {
        final Class c = ObjectUtilities.getClassLoader(
                getClass()).loadClass(classname);
        final Method m = c.getMethod("getInstance", (Class[]) null);
        return (AbstractBoot) m.invoke(null, (Object[]) null);
    }
    catch (Exception e) {
        Log.info ("Unable to boot dependent class: " + classname);
        return null;
    }
}
 
Example 3
Source File: MappingModel.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Adds a manual mapping.
 * 
 * @param mappingInfo  the mapping.
 */
public void addManualMapping(final ManualMappingInfo mappingInfo) {
    if (!this.mappingInfos.containsKey(mappingInfo.getBaseClass())) {
        this.manualMappings.add(mappingInfo);
        this.mappingInfos.put(mappingInfo.getBaseClass(), mappingInfo);
    }
    else {
        final Object o = this.mappingInfos.get(mappingInfo.getBaseClass());
        if (o instanceof ManualMappingInfo) {
            Log.info ("Duplicate manual mapping: " + mappingInfo.getBaseClass());
        }
        else {
            throw new IllegalArgumentException
                ("This mapping is already a multiplex mapping.");
        }
    }
}
 
Example 4
Source File: MappingModel.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Adds a multiplex mapping.
 * 
 * @param mappingInfo  the mapping.
 */
public void addMultiplexMapping(final MultiplexMappingInfo mappingInfo) {
    if (!this.mappingInfos.containsKey(mappingInfo.getBaseClass())) {
        this.multiplexMappings.add(mappingInfo);
        this.mappingInfos.put(mappingInfo.getBaseClass(), mappingInfo);
    }
    else {
        final Object o = this.mappingInfos.get(mappingInfo.getBaseClass());
        if (o instanceof ManualMappingInfo) {
            throw new IllegalArgumentException
                ("This mapping is already a manual mapping.");
        }
        else {
            Log.info(
                "Duplicate Multiplex mapping: " + mappingInfo.getBaseClass(), new Exception()
            );
        }
    }

}
 
Example 5
Source File: RenderingHintValueReadHandler.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
private Object stringToHintField (final String name) {
    final Field[] fields = RenderingHints.class.getFields();
    for (int i = 0; i < fields.length; i++) {
        final Field f = fields[i];
        if (Modifier.isFinal(f.getModifiers()) 
            && Modifier.isPublic(f.getModifiers()) 
            && Modifier.isStatic(f.getModifiers())) {
            try {
                final String fieldName = f.getName();
                if (fieldName.equals(name)) {
                    return f.get(null);
                }
            }
            catch (Exception e) {
                Log.info ("Unable to write RenderingHint", e);
            }
        }
    }
    throw new IllegalArgumentException("Invalid value given");
}
 
Example 6
Source File: RenderingHintsWriteHandler.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
private String hintFieldToString(final Object o) {
    final Field[] fields = RenderingHints.class.getFields();
    for (int i = 0; i < fields.length; i++) {
        final Field f = fields[i];
        if (Modifier.isFinal(f.getModifiers()) 
            && Modifier.isPublic(f.getModifiers()) 
            && Modifier.isStatic(f.getModifiers())) {
            try {
                final Object value = f.get(null);
                if (o.equals(value)) {
                    return f.getName();
                }
            }
            catch (Exception e) {
                Log.info ("Unable to write RenderingHint", e);
            }
        }
    }
    throw new IllegalArgumentException("Invalid value given");
}
 
Example 7
Source File: GithubOauthLoginAction.java    From DotCi with MIT License 6 votes vote down vote up
public HttpResponse doFinishLogin(StaplerRequest request, StaplerResponse rsp) throws IOException {

        String code = request.getParameter("code");

        if (code == null || code.trim().length() == 0) {
            Log.info("doFinishLogin: missing code.");
            return HttpResponses.redirectToContextRoot();
        }

        String content = postForAccessToken(code);

        String accessToken = extractToken(content);
        updateOfflineAccessTokenForUser(accessToken);
        request.getSession().setAttribute("access_token", accessToken);

        String newProjectSetupUrl = getJenkinsRootUrl() + "/" + GithubReposController.URL;
        return HttpResponses.redirectTo(newProjectSetupUrl);
    }
 
Example 8
Source File: BeanObjectDescription.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the parameters in the description to match the supplied object.
 *
 * @param o  the object (<code>null</code> not allowed).
 *
 * @throws ObjectFactoryException if there is a problem.
 */
public void setParameterFromObject(final Object o)
    throws ObjectFactoryException {
    if (o == null) {
        throw new NullPointerException("Given object is null");
    }
    final Class c = getObjectClass();
    if (!c.isInstance(o)) {
        throw new ObjectFactoryException("Object is no instance of " + c 
            + "(is " + o.getClass() + ")");
    }

    final Iterator it = getParameterNames();
    while (it.hasNext()) {
        final String propertyName = (String) it.next();

        if (isParameterIgnored(propertyName)) {
            continue;
        }

        try {
            final Method method = findGetMethod(propertyName);
            final Object retval = method.invoke(o, (Object[]) null);
            if (retval != null) {
                setParameter(propertyName, retval);
            }
        }
        catch (Exception e) {
            Log.info("Exception on method invokation.", e);
        }

    }
}
 
Example 9
Source File: GitLabSecurityRealm.java    From gitlab-oauth-plugin with MIT License 4 votes vote down vote up
/**
 * This is where the user comes back to at the end of the OpenID redirect
 * ping-pong.
 */
public HttpResponse doFinishLogin(StaplerRequest request) throws IOException {
    String code = request.getParameter("code");

    if (StringUtils.isBlank(code)) {
        Log.info("doFinishLogin: missing code or private_token.");
        return HttpResponses.redirectToContextRoot();
    }

    String state = request.getParameter("state");

    HttpPost httpPost = new HttpPost(gitlabWebUri + "/oauth/token");
    List<NameValuePair> parameters = new ArrayList<NameValuePair>();
    parameters.add(new BasicNameValuePair("client_id", clientID));
    parameters.add(new BasicNameValuePair("client_secret", clientSecret));
    parameters.add(new BasicNameValuePair("code", code));
    parameters.add(new BasicNameValuePair("grant_type", "authorization_code"));
    parameters.add(new BasicNameValuePair("redirect_uri", buildRedirectUrl(request, state)));
    httpPost.setEntity(new UrlEncodedFormEntity(parameters, StandardCharsets.UTF_8));

    CloseableHttpClient httpclient = HttpClients.createDefault();
    HttpHost proxy = getProxy(httpPost);
    if (proxy != null) {
        RequestConfig config = RequestConfig.custom()
                .setProxy(proxy)
                .build();
        httpPost.setConfig(config);
    }

    org.apache.http.HttpResponse response = httpclient.execute(httpPost);

    HttpEntity entity = response.getEntity();

    String content = EntityUtils.toString(entity);

    // When HttpClient instance is no longer needed,
    // shut down the connection manager to ensure
    // immediate deallocation of all system resources
    httpclient.close();

    String accessToken = extractToken(content);

    if (StringUtils.isNotBlank(accessToken)) {
        // only set the access token if it exists.
        GitLabAuthenticationToken auth = new GitLabAuthenticationToken(accessToken, getGitlabApiUri(), TokenType.ACCESS_TOKEN);

        HttpSession session = request.getSession(false);
        if (session != null) {
            // avoid session fixation
            session.invalidate();
        }
        request.getSession(true);

        SecurityContextHolder.getContext().setAuthentication(auth);

        GitlabUser self = auth.getMyself();
        User user = User.current();
        if (user != null) {
            user.setFullName(self.getName());
            // Set email from gitlab only if empty
            if (!user.getProperty(Mailer.UserProperty.class).hasExplicitlyConfiguredAddress()) {
                user.addProperty(new Mailer.UserProperty(auth.getMyself().getEmail()));
            }
        }
        SecurityListener.fireAuthenticated(new GitLabOAuthUserDetails(self, auth.getAuthorities()));
    } else {
        Log.info("Gitlab did not return an access token.");
    }

    if (StringUtils.isNotBlank(state)) {
        return HttpResponses.redirectTo(state);
    }
    return HttpResponses.redirectToContextRoot();
}