Package org.jolokia.util

Examples of org.jolokia.util.LogHandler


     *
     * @param pLocation location to lookup the restrictor
     * @return the restrictor to use.
     */
    protected Restrictor createRestrictor(String pLocation) {
        LogHandler log = getLogHandler();
        try {
            Restrictor newRestrictor = RestrictorFactory.lookupPolicyRestrictor(pLocation);
            if (newRestrictor != null) {
                log.info("Using access restrictor " + pLocation);
                return newRestrictor;
            } else {
                log.info("No access restrictor found at " + pLocation + ", access to all MBeans is allowed");
                return new AllowAllRestrictor();
            }
        } catch (IOException e) {
            log.error("Error while accessing access restrictor at " + pLocation +
                              ". Denying all access to MBeans for security reasons. Exception: " + e, e);
            return new DenyAllRestrictor();
        }
    }
View Full Code Here


     *
     * @return a default log handlera
     * @param pServletConfig
     */
    protected LogHandler createLogHandler(ServletConfig pServletConfig) {
        return new LogHandler() {
            public void debug(String message) {
                log(message);
            }

            public void info(String message) {
View Full Code Here

        replay(config, servletContext, bundleContext);

        servlet.init(config);
        assertNull(JolokiaServlet.getCurrentBundleContext());

        LogHandler handler = servlet.createLogHandler(config, true);
        handler.debug("Debug");
        handler.info("Info");
        handler.error("Error",new Exception());
        destroyServlet();
    }
View Full Code Here

        MBeanServer mockServer = createMock(MBeanServer.class);
        expect(mockServer.queryNames(new ObjectName("amx:type=domain-root,*"),null)).andReturn(Collections.<ObjectName>emptySet()).anyTimes();
        ObjectName bootAmxName = new ObjectName("amx-support:type=boot-amx");
        expect(mockServer.isRegistered(bootAmxName)).andStubReturn(true);
        expect(mockServer.invoke(bootAmxName, "bootAMX", null, null)).andThrow(exp);
        LogHandler log = createMock(LogHandler.class);
        log.error(matches(regexp),isA(exp.getClass()));
        replay(mockServer,log);
        MBeanServerExecutor servers = getMBeanServerManager(mockServer);
        handle.postDetect(servers,new Configuration(),log);
        handle.preDispatch(servers,null);
        verify(mockServer);
View Full Code Here

    // ===================================================================================================

    private void init() throws MalformedObjectNameException {
        TestDetector.reset();
        Configuration config = new Configuration(ConfigKey.MBEAN_QUALIFIER,"qualifier=test");
        handler = new MBeanServerHandler(config, new LogHandler() {
            public void debug(String message) {
            }

            public void info(String message) {
            }
View Full Code Here

        assertNull(config);
    }

    @Test
    public void detectOptionsFail() {
        LogHandler handler = EasyMock.createMock(LogHandler.class);
        handler.error(matches("^.*parse options.*"),isA(Exception.class));
        replay(handler);

        Configuration opts = new Configuration(ConfigKey.DETECTOR_OPTIONS,"blub: bla");
        JSONObject config = serverHandle.getDetectorOptions(opts,handler);
        assertNull(config);
View Full Code Here

    // ===================================================================================================


    private LogHandler getEmptyLogHandler() {
        return new LogHandler() {
            public void debug(String message) {
            }

            public void info(String message) {
            }
View Full Code Here

    }

    // ======================================================================================================

    private LogHandler createDummyLogHandler() {
        return new LogHandler() {
                public void debug(String message) {
                }

                public void info(String message) {
                }
View Full Code Here

public class Dispatcher {
  private final HttpRequestHandler handler;

  public Dispatcher() {
    final LogHandler h = new LogHandler() {
      public void debug(String message) {
      }

      public void info(String message) {
      }
View Full Code Here

TOP

Related Classes of org.jolokia.util.LogHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.