Esempio n. 1
0
 private void initDiscoveryMulticast(Configuration pConfig) {
   String url = findAgentUrl(pConfig);
   if (url != null || listenForDiscoveryMcRequests(pConfig)) {
     backendManager.getAgentDetails().setUrl(url);
     try {
       discoveryMulticastResponder =
           new DiscoveryMulticastResponder(backendManager, restrictor, logHandler);
       discoveryMulticastResponder.start();
     } catch (IOException e) {
       logHandler.error("Cannot start discovery multicast handler: " + e, e);
     }
   }
 }
Esempio n. 2
0
 /**
  * Create a restrictor restrictor to use. By default, a policy file is looked up (with the URL
  * given by the init parameter {@link ConfigKey#POLICY_LOCATION} or "/jolokia-access.xml" by
  * default) and if not found an {@link AllowAllRestrictor} is used by default. This method is
  * called during the {@link #init(ServletConfig)} when initializing the subsystems and can be
  * overridden for custom restrictor creation.
  *
  * @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();
   }
 }