SystemInformationsButtonsPanel(
      RemoteCollector remoteCollector, URL monitoringUrl, boolean collectorServer) {
    super(remoteCollector);
    this.javaInformationsList = getJavaInformationsList();
    this.monitoringUrl = monitoringUrl;

    if (collectorServer) {
      final JPanel currentRequestsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
      currentRequestsPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 15, 0));
      currentRequestsPanel.setOpaque(false);
      currentRequestsPanel.add(createCurrentRequestsButton());
      add(currentRequestsPanel, BorderLayout.NORTH);
    }
    if (Parameters.isSystemActionsEnabled()) {
      final JPanel centerPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));
      centerPanel.setOpaque(false);
      final JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));
      southPanel.setOpaque(false);

      centerPanel.add(createGcButton());
      centerPanel.add(createHeapDumpButton());
      centerPanel.add(createHeapHistoButton());

      if (isSessionsEnabled()) {
        centerPanel.add(createInvalidateSessionsButton());
        centerPanel.add(createSessionsButton());
      }

      centerPanel.add(createHotspotsButton());

      if (doesWebXmlExists()) {
        // on n'affiche le lien web.xml que si le fichier existe (pour api servlet 3.0 par ex)
        southPanel.add(createWebXmlButton());
      }

      southPanel.add(createMBeansButton());
      southPanel.add(createProcessesButton());

      final String serverInfo = javaInformationsList.get(0).getServerInfo();
      if (serverInfo != null && !serverInfo.contains("Winstone")) {
        // on n'affiche pas le lien JNDI si serveur Winstone car cela n'a pas d'intérêt
        // pour Hudson/Jenkins sous Winstone, et surtout car (Winstone)Context.listBindings
        // renvoie une liste de NameClassPair au lieu d'une liste de Binding comme il le devrait

        southPanel.add(createJndiButton());
      }

      if (isDatabaseEnabled()) {
        southPanel.add(createConnectionsButton());

        southPanel.add(createDatabaseButton());
      }

      add(centerPanel, BorderLayout.CENTER);
      add(southPanel, BorderLayout.SOUTH);
    }
  }
Example #2
0
 private JdbcWrapper(Counter sqlCounter) {
   super();
   assert sqlCounter != null;
   this.sqlCounter = sqlCounter;
   // servletContext reste null pour l'instant
   this.servletContext = null;
   connectionInformationsEnabled =
       Parameters.isSystemActionsEnabled() && !Parameters.isNoDatabase();
 }
Example #3
0
 void initServletContext(ServletContext context) {
   assert context != null;
   this.servletContext = context;
   final String serverInfo = servletContext.getServerInfo();
   jboss = serverInfo.contains("JBoss") || serverInfo.contains("WildFly");
   glassfish =
       serverInfo.contains("GlassFish")
           || serverInfo.contains("Sun Java System Application Server");
   weblogic = serverInfo.contains("WebLogic");
   jonas = System.getProperty("jonas.name") != null;
   connectionInformationsEnabled =
       Parameters.isSystemActionsEnabled() && !Parameters.isNoDatabase();
 }