com-sun-tools-visualvm-application

16:33:42.765 INFO  jd.cli.Main - Decompiling com-sun-tools-visualvm-application.jar
package com.sun.tools.visualvm.application;

import java.beans.PropertyChangeSupport;

class Application$1
  implements Runnable
{
  Application$1(Application paramApplication, int paramInt1, int paramInt2) {}
  
  public void run()
  {
    Application.access$000(this$0).firePropertyChange("prop_state", val$oldState, val$newState);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.Application.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.datasource.Storage;
import com.sun.tools.visualvm.core.datasupport.Stateful;
import com.sun.tools.visualvm.host.Host;
import java.beans.PropertyChangeSupport;
import java.io.File;
import org.openide.util.RequestProcessor;

public abstract class Application
  extends DataSource
  implements Stateful
{
  public static final Application CURRENT_APPLICATION = ApplicationSupport.getInstance().createCurrentApplication();
  public static final int UNKNOWN_PID = -1;
  private String id;
  private Host host;
  private int state = 1;
  
  public Application(Host host, String id)
  {
    if (host == null) {
      throw new IllegalArgumentException("Host cannot be null");
    }
    if (id == null) {
      throw new IllegalArgumentException("Application id cannot be null");
    }
    this.host = host;
    this.id = id;
  }
  
  public final String getId()
  {
    return id;
  }
  
  public int getPid()
  {
    return -1;
  }
  
  public final Host getHost()
  {
    return host;
  }
  
  public final boolean isLocalApplication()
  {
    return Host.LOCALHOST.equals(getHost());
  }
  
  public final synchronized int getState()
  {
    return state;
  }
  
  protected final synchronized void setState(final int newState)
  {
    final int oldState = state;
    state = newState;
    if (DataSource.EVENT_QUEUE.isRequestProcessorThread()) {
      getChangeSupport().firePropertyChange("prop_state", oldState, newState);
    } else {
      DataSource.EVENT_QUEUE.post(new Runnable()
      {
        public void run()
        {
          getChangeSupport().firePropertyChange("prop_state", oldState, newState);
        }
      });
    }
  }
  
  public final int hashCode()
  {
    return getId().hashCode();
  }
  
  public final boolean equals(Object obj)
  {
    if (!(obj instanceof Application)) {
      return false;
    }
    Application app = (Application)obj;
    return getId().equals(app.getId());
  }
  
  public String toString()
  {
    return "Application [id: " + getId() + ", pid: " + getPid() + ", host: " + getHost().getHostName() + "]";
  }
  
  protected Storage createStorage()
  {
    File directory = new File(Storage.getTemporaryStorageDirectoryString() + File.separator + validFileName(getId()));
    
    return new Storage(directory);
  }
  
  private static String validFileName(String fileName)
  {
    char[] fileNameCh = fileName.toCharArray();
    StringBuilder validFileName = new StringBuilder();
    for (char ch : fileNameCh) {
      if (Character.isLetterOrDigit(ch)) {
        validFileName.append(ch);
      } else {
        validFileName.append('_');
      }
    }
    return validFileName.toString();
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.Application
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.application.type.ApplicationType;
import java.awt.Image;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

class ApplicationDescriptor$1
  implements PropertyChangeListener
{
  ApplicationDescriptor$1(ApplicationDescriptor paramApplicationDescriptor, Application paramApplication, ApplicationType paramApplicationType) {}
  
  public void propertyChange(PropertyChangeEvent evt)
  {
    String propertyName = evt.getPropertyName();
    if ("name".equals(propertyName))
    {
      if (ApplicationDescriptor.access$000(val$application, null) != null) {
        return;
      }
      if (this$0.supportsRename())
      {
        this$0.setName((String)evt.getNewValue());
        ApplicationDescriptor.access$102(this$0, ApplicationDescriptor.access$201(this$0));
      }
      else
      {
        String oldName = ApplicationDescriptor.access$100(this$0);
        ApplicationDescriptor.access$102(this$0, ApplicationDescriptor.access$300(val$application, val$type.getName()));
        PropertyChangeSupport pcs = ApplicationDescriptor.access$400(this$0);
        pcs.firePropertyChange("prop_name", oldName, ApplicationDescriptor.access$100(this$0));
      }
    }
    else if ("icon".equals(propertyName))
    {
      ApplicationDescriptor.access$500(this$0, (Image)evt.getNewValue());
    }
    else if ("description".equals(propertyName))
    {
      ApplicationDescriptor.access$600(this$0, (String)evt.getNewValue());
    }
    else if (!"version".equals(propertyName)) {}
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.ApplicationDescriptor.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.application.type.ApplicationType;
import com.sun.tools.visualvm.application.type.ApplicationTypeFactory;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import java.awt.Image;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

public class ApplicationDescriptor
  extends DataSourceDescriptor<Application>
{
  private String name;
  
  protected ApplicationDescriptor(Application application)
  {
    this(application, ApplicationTypeFactory.getApplicationTypeFor(application), 2147483646);
  }
  
  protected ApplicationDescriptor(Application application, int preferredPosition)
  {
    this(application, ApplicationTypeFactory.getApplicationTypeFor(application), preferredPosition);
  }
  
  private ApplicationDescriptor(final Application application, final ApplicationType type, int preferredPosition)
  {
    super(application, resolveApplicationName(application, type), type.getDescription(), type.getIcon(), preferredPosition, 1);
    
    name = super.getName();
    type.addPropertyChangeListener(new PropertyChangeListener()
    {
      public void propertyChange(PropertyChangeEvent evt)
      {
        String propertyName = evt.getPropertyName();
        if ("name".equals(propertyName))
        {
          if (ApplicationDescriptor.resolveName(application, null) != null) {
            return;
          }
          if (supportsRename())
          {
            setName((String)evt.getNewValue());
            name = ApplicationDescriptor.this.getName();
          }
          else
          {
            String oldName = name;
            name = ApplicationDescriptor.createGenericName(application, type.getName());
            PropertyChangeSupport pcs = getChangeSupport();
            pcs.firePropertyChange("prop_name", oldName, name);
          }
        }
        else if ("icon".equals(propertyName))
        {
          setIcon((Image)evt.getNewValue());
        }
        else if ("description".equals(propertyName))
        {
          setDescription((String)evt.getNewValue());
        }
        else if (!"version".equals(propertyName)) {}
      }
    });
  }
  
  public String getName()
  {
    if (supportsRename()) {
      return super.getName();
    }
    return name;
  }
  
  public boolean providesProperties()
  {
    return true;
  }
  
  protected static String resolveApplicationName(Application application, ApplicationType type)
  {
    String persistedName = resolveName(application, null);
    if (persistedName != null) {
      return persistedName;
    }
    return createGenericName(application, type.getName());
  }
  
  private static String createGenericName(Application application, String nameBase)
  {
    int pid = application.getPid();
    String id = " (pid " + pid + ")";
    
    return nameBase + id;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.ApplicationDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.model.AbstractModelProvider;

class ApplicationDescriptorProvider
  extends AbstractModelProvider<DataSourceDescriptor, DataSource>
{
  public DataSourceDescriptor createModelFor(DataSource ds)
  {
    if ((ds instanceof Application)) {
      return new ApplicationDescriptor((Application)ds);
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.ApplicationDescriptorProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.core.datasource.DataSourceContainer;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory;
import com.sun.tools.visualvm.host.Host;
import com.sun.tools.visualvm.host.LocalHostDescriptor;

class ApplicationSupport$1$1
  implements Runnable
{
  ApplicationSupport$1$1(ApplicationSupport.1 param1) {}
  
  public void run()
  {
    DataSourceDescriptor localHostDescriptor = DataSourceDescriptorFactory.getDescriptor(Host.LOCALHOST);
    if ((localHostDescriptor instanceof LocalHostDescriptor)) {
      ((LocalHostDescriptor)localHostDescriptor).setChildrenComparator(ApplicationsSorting.instance().getInitialSorting());
    }
    Host.LOCALHOST.getRepository().addDataSource(Application.CURRENT_APPLICATION);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.ApplicationSupport.1.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.core.datasource.DataSourceContainer;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory;
import com.sun.tools.visualvm.host.Host;
import com.sun.tools.visualvm.host.LocalHostDescriptor;
import org.openide.util.RequestProcessor;

class ApplicationSupport$1
  implements Runnable
{
  ApplicationSupport$1(ApplicationSupport paramApplicationSupport) {}
  
  public void run()
  {
    RequestProcessor.getDefault().post(new Runnable()
    {
      public void run()
      {
        DataSourceDescriptor localHostDescriptor = DataSourceDescriptorFactory.getDescriptor(Host.LOCALHOST);
        if ((localHostDescriptor instanceof LocalHostDescriptor)) {
          ((LocalHostDescriptor)localHostDescriptor).setChildrenComparator(ApplicationsSorting.instance().getInitialSorting());
        }
        Host.LOCALHOST.getRepository().addDataSource(Application.CURRENT_APPLICATION);
      }
    });
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.ApplicationSupport.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.application.jvm.Jvm;
import com.sun.tools.visualvm.host.Host;

class ApplicationSupport$CurrentApplication
  extends Application
{
  private int selfPid;
  Jvm jvm;
  
  private ApplicationSupport$CurrentApplication(ApplicationSupport paramApplicationSupport, int selfPid, Host host, String id)
  {
    super(host, id);
    this.selfPid = selfPid;
  }
  
  public int getPid()
  {
    return selfPid;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.ApplicationSupport.CurrentApplication
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.application.jvm.Jvm;
import com.sun.tools.visualvm.core.datasource.DataSourceContainer;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory;
import com.sun.tools.visualvm.core.properties.PropertiesSupport;
import com.sun.tools.visualvm.host.Host;
import com.sun.tools.visualvm.host.LocalHostDescriptor;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import org.openide.util.RequestProcessor;
import org.openide.windows.WindowManager;

final class ApplicationSupport
{
  private static ApplicationSupport instance;
  
  public static synchronized ApplicationSupport getInstance()
  {
    if (instance == null) {
      instance = new ApplicationSupport();
    }
    return instance;
  }
  
  Application createCurrentApplication()
  {
    String selfName = ManagementFactory.getRuntimeMXBean().getName();
    int selfPid = Integer.valueOf(selfName.substring(0, selfName.indexOf('@'))).intValue();
    return new CurrentApplication(selfPid, Host.LOCALHOST, Host.LOCALHOST.getHostName() + "-" + selfPid, null);
  }
  
  private void initCurrentApplication()
  {
    WindowManager.getDefault().invokeWhenUIReady(new Runnable()
    {
      public void run()
      {
        RequestProcessor.getDefault().post(new Runnable()
        {
          public void run()
          {
            DataSourceDescriptor localHostDescriptor = DataSourceDescriptorFactory.getDescriptor(Host.LOCALHOST);
            if ((localHostDescriptor instanceof LocalHostDescriptor)) {
              ((LocalHostDescriptor)localHostDescriptor).setChildrenComparator(ApplicationsSorting.instance().getInitialSorting());
            }
            Host.LOCALHOST.getRepository().addDataSource(Application.CURRENT_APPLICATION);
          }
        });
      }
    });
  }
  
  private ApplicationSupport()
  {
    DataSourceDescriptorFactory descriptorFactory = DataSourceDescriptorFactory.getDefault();
    descriptorFactory.registerProvider(new ApplicationDescriptorProvider());
    descriptorFactory.registerProvider(new UserNameDescriptorProvider());
    PropertiesSupport.sharedInstance().registerPropertiesProvider(new GeneralPropertiesProvider(), CurrentApplication.class);
    
    initCurrentApplication();
  }
  
  class CurrentApplication
    extends Application
  {
    private int selfPid;
    Jvm jvm;
    
    private CurrentApplication(int selfPid, Host host, String id)
    {
      super(id);
      this.selfPid = selfPid;
    }
    
    public int getPid()
    {
      return selfPid;
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.ApplicationSupport
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import java.awt.Component;
import javax.swing.JMenu;

class ApplicationsSorting$1
  extends JMenu
{
  ApplicationsSorting$1(ApplicationsSorting paramApplicationsSorting) {}
  
  protected void fireMenuSelected()
  {
    Component[] items = getMenuComponents();
    for (Component item : items) {
      if ((item instanceof ApplicationsSorting.SortAction)) {
        ((ApplicationsSorting.SortAction)item).updateAction();
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.ApplicationsSorting.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory;
import java.util.Comparator;

final class ApplicationsSorting$2
  implements Comparator<DataSource>
{
  public int compare(DataSource d1, DataSource d2)
  {
    DataSourceDescriptor dd1 = DataSourceDescriptorFactory.getDescriptor(d1);
    DataSourceDescriptor dd2 = DataSourceDescriptorFactory.getDescriptor(d2);
    
    return dd1.getName().compareTo(dd2.getName());
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.ApplicationsSorting.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.core.datasource.DataSource;
import java.util.Comparator;

final class ApplicationsSorting$3
  implements Comparator<DataSource>
{
  public int compare(DataSource d1, DataSource d2)
  {
    boolean d1app = d1 instanceof Application;
    boolean d2app = d2 instanceof Application;
    if ((!d1app) && (!d2app)) {
      return ApplicationsSorting.access$000().compare(d1, d2);
    }
    if (!d1app) {
      return 1;
    }
    if (!d2app) {
      return -1;
    }
    int d1pid = ((Application)d1).getPid();
    if (d1pid == -1) {
      d1pid = Integer.MAX_VALUE;
    }
    int d2pid = ((Application)d2).getPid();
    if (d2pid == -1) {
      d2pid = Integer.MAX_VALUE;
    }
    if (d1pid == d2pid) {
      return ApplicationsSorting.access$000().compare(d1, d2);
    }
    if (d1pid > d2pid) {
      return 1;
    }
    return -1;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.ApplicationsSorting.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.datasource.DataSourceRepository;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory;
import com.sun.tools.visualvm.host.Host;
import com.sun.tools.visualvm.host.LocalHostDescriptor;
import com.sun.tools.visualvm.host.RemoteHostDescriptor;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.prefs.Preferences;

class ApplicationsSorting$4
  implements ApplicationsSorting.Sorter
{
  ApplicationsSorting$4(ApplicationsSorting paramApplicationsSorting) {}
  
  public void sort(Comparator<DataSource> comparator)
  {
    DataSourceDescriptor ld = DataSourceDescriptorFactory.getDescriptor(Host.LOCALHOST);
    if ((ld instanceof LocalHostDescriptor))
    {
      ((LocalHostDescriptor)ld).setChildrenComparator(comparator);
      ApplicationsSorting.access$200(this$0).putInt("Applications.sorting", ApplicationsSorting.access$100().indexOf(comparator));
    }
    Set<Host> remoteHosts = DataSourceRepository.sharedInstance().getDataSources(Host.class);
    for (Host host : remoteHosts) {
      if (host != Host.LOCALHOST)
      {
        DataSourceDescriptor rd = DataSourceDescriptorFactory.getDescriptor(host);
        if ((rd instanceof RemoteHostDescriptor)) {
          ((RemoteHostDescriptor)rd).setChildrenComparator(comparator);
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.ApplicationsSorting.4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory;
import com.sun.tools.visualvm.host.Host;
import com.sun.tools.visualvm.host.LocalHostDescriptor;
import java.awt.event.ActionEvent;
import java.util.Comparator;
import javax.swing.JRadioButtonMenuItem;
import org.openide.awt.Mnemonics;

class ApplicationsSorting$SortAction
  extends JRadioButtonMenuItem
{
  private final ApplicationsSorting.Sorter sorter;
  private final Comparator<DataSource> comparator;
  private boolean currentlySelected;
  
  ApplicationsSorting$SortAction(String name, Comparator<DataSource> comparator, ApplicationsSorting.Sorter sorter)
  {
    Mnemonics.setLocalizedText(this, name);
    this.comparator = comparator;
    this.sorter = sorter;
  }
  
  void updateAction()
  {
    DataSourceDescriptor d = DataSourceDescriptorFactory.getDescriptor(Host.LOCALHOST);
    
    setEnabled(d instanceof LocalHostDescriptor);
    currentlySelected = (d.getChildrenComparator() == comparator);
    setSelected(currentlySelected);
  }
  
  protected void fireActionPerformed(ActionEvent e)
  {
    if (!currentlySelected) {
      sorter.sort(comparator);
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.ApplicationsSorting.SortAction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.core.datasource.DataSource;
import java.util.Comparator;

abstract interface ApplicationsSorting$Sorter
{
  public abstract void sort(Comparator<DataSource> paramComparator);
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.ApplicationsSorting.Sorter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.datasource.DataSourceRepository;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory;
import com.sun.tools.visualvm.host.Host;
import com.sun.tools.visualvm.host.LocalHostDescriptor;
import com.sun.tools.visualvm.host.RemoteHostDescriptor;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.prefs.Preferences;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JRadioButtonMenuItem;
import org.openide.awt.Mnemonics;
import org.openide.util.NbBundle;
import org.openide.util.NbPreferences;
import org.openide.util.actions.Presenter.Menu;

final class ApplicationsSorting
  implements Presenter.Menu
{
  private static final String PROP_APPS_SORTING = "Applications.sorting";
  private static ApplicationsSorting instance;
  private static final Comparator<DataSource> BY_TIME_COMPARATOR = ;
  private static final Comparator<DataSource> BY_NAME_COMPARATOR = byNameComparator();
  private static final Comparator<DataSource> BY_PID_COMPARATOR = byPidComparator();
  private static final List<Comparator<DataSource>> COMPARATORS = new ArrayList();
  private final Preferences prefs;
  private JMenuItem presenter;
  private final Sorter sorter;
  
  static
  {
    COMPARATORS.add(BY_TIME_COMPARATOR);COMPARATORS.add(BY_NAME_COMPARATOR);
    COMPARATORS.add(BY_PID_COMPARATOR);
  }
  
  public static synchronized ApplicationsSorting instance()
  {
    if (instance == null) {
      instance = new ApplicationsSorting();
    }
    return instance;
  }
  
  public JMenuItem getMenuPresenter()
  {
    if (presenter == null) {
      presenter = createPresenter();
    }
    return presenter;
  }
  
  Comparator<DataSource> getInitialSorting()
  {
    return (Comparator)COMPARATORS.get(prefs.getInt("Applications.sorting", COMPARATORS.indexOf(BY_TIME_COMPARATOR)));
  }
  
  private JMenuItem createPresenter()
  {
    JMenu menu = new JMenu()
    {
      protected void fireMenuSelected()
      {
        Component[] items = getMenuComponents();
        for (Component item : items) {
          if ((item instanceof ApplicationsSorting.SortAction)) {
            ((ApplicationsSorting.SortAction)item).updateAction();
          }
        }
      }
    };
    Mnemonics.setLocalizedText(menu, NbBundle.getMessage(ApplicationsSorting.class, "ACT_SortApps"));
    
    menu.add(new SortAction(NbBundle.getMessage(ApplicationsSorting.class, "ACT_TimeAdded"), BY_TIME_COMPARATOR, sorter));
    
    menu.add(new SortAction(NbBundle.getMessage(ApplicationsSorting.class, "ACT_DisplayName"), BY_NAME_COMPARATOR, sorter));
    
    menu.add(new SortAction(NbBundle.getMessage(ApplicationsSorting.class, "ACT_Pid"), BY_PID_COMPARATOR, sorter));
    
    return menu;
  }
  
  private static Comparator<DataSource> byTimeComparator()
  {
    return null;
  }
  
  private static Comparator<DataSource> byNameComparator()
  {
    new Comparator()
    {
      public int compare(DataSource d1, DataSource d2)
      {
        DataSourceDescriptor dd1 = DataSourceDescriptorFactory.getDescriptor(d1);
        DataSourceDescriptor dd2 = DataSourceDescriptorFactory.getDescriptor(d2);
        
        return dd1.getName().compareTo(dd2.getName());
      }
    };
  }
  
  private static Comparator<DataSource> byPidComparator()
  {
    new Comparator()
    {
      public int compare(DataSource d1, DataSource d2)
      {
        boolean d1app = d1 instanceof Application;
        boolean d2app = d2 instanceof Application;
        if ((!d1app) && (!d2app)) {
          return ApplicationsSorting.BY_NAME_COMPARATOR.compare(d1, d2);
        }
        if (!d1app) {
          return 1;
        }
        if (!d2app) {
          return -1;
        }
        int d1pid = ((Application)d1).getPid();
        if (d1pid == -1) {
          d1pid = Integer.MAX_VALUE;
        }
        int d2pid = ((Application)d2).getPid();
        if (d2pid == -1) {
          d2pid = Integer.MAX_VALUE;
        }
        if (d1pid == d2pid) {
          return ApplicationsSorting.BY_NAME_COMPARATOR.compare(d1, d2);
        }
        if (d1pid > d2pid) {
          return 1;
        }
        return -1;
      }
    };
  }
  
  private ApplicationsSorting()
  {
    prefs = NbPreferences.forModule(ApplicationsSorting.class);
    
    sorter = new Sorter()
    {
      public void sort(Comparator<DataSource> comparator)
      {
        DataSourceDescriptor ld = DataSourceDescriptorFactory.getDescriptor(Host.LOCALHOST);
        if ((ld instanceof LocalHostDescriptor))
        {
          ((LocalHostDescriptor)ld).setChildrenComparator(comparator);
          prefs.putInt("Applications.sorting", ApplicationsSorting.COMPARATORS.indexOf(comparator));
        }
        Set<Host> remoteHosts = DataSourceRepository.sharedInstance().getDataSources(Host.class);
        for (Host host : remoteHosts) {
          if (host != Host.LOCALHOST)
          {
            DataSourceDescriptor rd = DataSourceDescriptorFactory.getDescriptor(host);
            if ((rd instanceof RemoteHostDescriptor)) {
              ((RemoteHostDescriptor)rd).setChildrenComparator(comparator);
            }
          }
        }
      }
    };
  }
  
  private static abstract interface Sorter
  {
    public abstract void sort(Comparator<DataSource> paramComparator);
  }
  
  private static class SortAction
    extends JRadioButtonMenuItem
  {
    private final ApplicationsSorting.Sorter sorter;
    private final Comparator<DataSource> comparator;
    private boolean currentlySelected;
    
    SortAction(String name, Comparator<DataSource> comparator, ApplicationsSorting.Sorter sorter)
    {
      Mnemonics.setLocalizedText(this, name);
      this.comparator = comparator;
      this.sorter = sorter;
    }
    
    void updateAction()
    {
      DataSourceDescriptor d = DataSourceDescriptorFactory.getDescriptor(Host.LOCALHOST);
      
      setEnabled(d instanceof LocalHostDescriptor);
      currentlySelected = (d.getChildrenComparator() == comparator);
      setSelected(currentlySelected);
    }
    
    protected void fireActionPerformed(ActionEvent e)
    {
      if (!currentlySelected) {
        sorter.sort(comparator);
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.ApplicationsSorting
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import java.awt.Dimension;
import javax.swing.JTextArea;

class GeneralPropertiesProvider$1
  extends JTextArea
{
  GeneralPropertiesProvider$1(GeneralPropertiesProvider paramGeneralPropertiesProvider, String x0)
  {
    super(x0);
  }
  
  public Dimension getMinimumSize()
  {
    Dimension prefSize = getPreferredSize();
    Dimension minSize = super.getMinimumSize();
    width = 0;
    if (height < height) {
      return prefSize;
    }
    return minSize;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.GeneralPropertiesProvider.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.core.properties.PropertiesPanel;
import com.sun.tools.visualvm.core.properties.PropertiesProvider;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.BorderFactory;
import javax.swing.JTextArea;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import org.openide.util.NbBundle;

class GeneralPropertiesProvider
  extends PropertiesProvider<ApplicationSupport.CurrentApplication>
{
  public GeneralPropertiesProvider()
  {
    super(NbBundle.getMessage(GeneralPropertiesProvider.class, "LBL_ConnectionProperties"), NbBundle.getMessage(GeneralPropertiesProvider.class, "DESCR_ConnectionProperties"), Integer.MIN_VALUE, 50);
  }
  
  public PropertiesPanel createPanel(ApplicationSupport.CurrentApplication dataSource)
  {
    PropertiesPanel panel = new PropertiesPanel();
    panel.setLayout(new BorderLayout());
    JTextArea textArea = new JTextArea(NbBundle.getMessage(GeneralPropertiesProvider.class, "MSG_ConnectionProperties"))
    {
      public Dimension getMinimumSize()
      {
        Dimension prefSize = getPreferredSize();
        Dimension minSize = super.getMinimumSize();
        width = 0;
        if (height < height) {
          return prefSize;
        }
        return minSize;
      }
    };
    textArea.setBorder(BorderFactory.createEmptyBorder());
    textArea.setOpaque(false);
    if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {
      textArea.setBackground(new Color(0, 0, 0, 0));
    }
    textArea.setEditable(false);
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);
    textArea.setCaretPosition(0);
    textArea.setMinimumSize(new Dimension(1, 1));
    panel.add(textArea, "Center");
    
    return panel;
  }
  
  public boolean supportsDataSource(ApplicationSupport.CurrentApplication dataSource)
  {
    return true;
  }
  
  public void propertiesDefined(PropertiesPanel panel, ApplicationSupport.CurrentApplication dataSource) {}
  
  public void propertiesChanged(PropertiesPanel panel, ApplicationSupport.CurrentApplication dataSource) {}
  
  public void propertiesCancelled(PropertiesPanel panel, ApplicationSupport.CurrentApplication dataSource) {}
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.GeneralPropertiesProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.application.snapshot.ApplicationSnapshotsSupport;
import org.openide.modules.ModuleInstall;

final class Installer
  extends ModuleInstall
{
  public void restored()
  {
    ApplicationSupport.getInstance();
    ApplicationSnapshotsSupport.getInstance();
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.Installer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

class UserNameDescriptor
  extends ApplicationDescriptor
{
  private String userName;
  
  protected UserNameDescriptor(Application application, String name)
  {
    super(application);
    userName = name;
  }
  
  public String getName()
  {
    return userName;
  }
  
  public String getDescription()
  {
    return super.getName();
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.UserNameDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application;

import com.sun.tools.visualvm.application.jvm.Jvm;
import com.sun.tools.visualvm.application.jvm.JvmFactory;
import com.sun.tools.visualvm.core.datasource.DataSource;
import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor;
import com.sun.tools.visualvm.core.model.AbstractModelProvider;

class UserNameDescriptorProvider
  extends AbstractModelProvider<DataSourceDescriptor, DataSource>
{
  private static final String DISPLAY_NAME_PROPERTY = "-Dvisualvm.display.name=";
  
  public DataSourceDescriptor createModelFor(DataSource ds)
  {
    if ((ds instanceof Application))
    {
      Application application = (Application)ds;
      
      Jvm jvm = JvmFactory.getJVMFor(application);
      if (jvm.isBasicInfoSupported())
      {
        String args = jvm.getJvmArgs();
        int propIndex = args.indexOf("-Dvisualvm.display.name=");
        if (propIndex != -1)
        {
          propIndex += "-Dvisualvm.display.name=".length();
          int endIndex = args.indexOf(" ", propIndex);
          String userName;
          String userName;
          if (endIndex == -1) {
            userName = args.substring(propIndex);
          } else {
            userName = args.substring(propIndex, endIndex);
          }
          return new UserNameDescriptor(application, userName);
        }
      }
    }
    return null;
  }
  
  public int priority()
  {
    return 3;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.UserNameDescriptorProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application.jvm;

import java.io.File;
import java.io.IOException;
import java.util.Properties;

class DefaultJvm
  extends Jvm
{
  public boolean is14()
  {
    return false;
  }
  
  public boolean is15()
  {
    return false;
  }
  
  public boolean is16()
  {
    return false;
  }
  
  public boolean is17()
  {
    return false;
  }
  
  public boolean isAttachable()
  {
    return false;
  }
  
  public String getCommandLine()
  {
    throw new UnsupportedOperationException();
  }
  
  public String getJvmArgs()
  {
    throw new UnsupportedOperationException();
  }
  
  public String getJvmFlags()
  {
    throw new UnsupportedOperationException();
  }
  
  public String getMainArgs()
  {
    throw new UnsupportedOperationException();
  }
  
  public String getMainClass()
  {
    throw new UnsupportedOperationException();
  }
  
  public String getVmVersion()
  {
    throw new UnsupportedOperationException();
  }
  
  public String getJavaVersion()
  {
    throw new UnsupportedOperationException();
  }
  
  public String getJavaHome()
  {
    throw new UnsupportedOperationException();
  }
  
  public String getVmInfo()
  {
    throw new UnsupportedOperationException();
  }
  
  public String getVmName()
  {
    throw new UnsupportedOperationException();
  }
  
  public String getVmVendor()
  {
    throw new UnsupportedOperationException();
  }
  
  public Properties getSystemProperties()
  {
    throw new UnsupportedOperationException();
  }
  
  public synchronized void addMonitoredDataListener(MonitoredDataListener l)
  {
    throw new UnsupportedOperationException();
  }
  
  public synchronized void removeMonitoredDataListener(MonitoredDataListener l)
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean isDumpOnOOMEnabled()
  {
    throw new UnsupportedOperationException();
  }
  
  public void setDumpOnOOMEnabled(boolean enabled)
  {
    throw new UnsupportedOperationException();
  }
  
  public File takeHeapDump()
    throws IOException
  {
    throw new UnsupportedOperationException();
  }
  
  public File takeThreadDump()
    throws IOException
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean isBasicInfoSupported()
  {
    return false;
  }
  
  public boolean isMonitoringSupported()
  {
    return (isClassMonitoringSupported()) || (isThreadMonitoringSupported()) || (isMemoryMonitoringSupported());
  }
  
  public boolean isClassMonitoringSupported()
  {
    return false;
  }
  
  public boolean isThreadMonitoringSupported()
  {
    return false;
  }
  
  public boolean isMemoryMonitoringSupported()
  {
    return false;
  }
  
  public boolean isGetSystemPropertiesSupported()
  {
    return false;
  }
  
  public boolean isDumpOnOOMEnabledSupported()
  {
    return false;
  }
  
  public boolean isTakeHeapDumpSupported()
  {
    return false;
  }
  
  public boolean isTakeThreadDumpSupported()
  {
    return false;
  }
  
  public boolean isCpuMonitoringSupported()
  {
    return false;
  }
  
  public boolean isCollectionTimeSupported()
  {
    return false;
  }
  
  public MonitoredData getMonitoredData()
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.jvm.DefaultJvm
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application.jvm;

public abstract class HeapHistogram$ClassInfo
{
  public abstract String getName();
  
  public abstract long getInstancesCount();
  
  public abstract long getBytes();
  
  public int hashCode()
  {
    return getName().hashCode();
  }
  
  public boolean equals(Object obj)
  {
    if ((obj instanceof ClassInfo)) {
      return getName().equals(((ClassInfo)obj).getName());
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.jvm.HeapHistogram.ClassInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application.jvm;

import java.util.Date;
import java.util.Set;

public abstract class HeapHistogram
{
  public abstract Date getTime();
  
  public abstract long getTotalInstances();
  
  public abstract long getTotalBytes();
  
  public abstract Set<ClassInfo> getHeapHistogram();
  
  public abstract long getTotalHeapInstances();
  
  public abstract long getTotalHeapBytes();
  
  public abstract Set<ClassInfo> getPermGenHistogram();
  
  public abstract long getTotalPerGenInstances();
  
  public abstract long getTotalPermGenHeapBytes();
  
  public static abstract class ClassInfo
  {
    public abstract String getName();
    
    public abstract long getInstancesCount();
    
    public abstract long getBytes();
    
    public int hashCode()
    {
      return getName().hashCode();
    }
    
    public boolean equals(Object obj)
    {
      if ((obj instanceof ClassInfo)) {
        return getName().equals(((ClassInfo)obj).getName());
      }
      return false;
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.application.jvm.HeapHistogram
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.application.jvm;

import com.sun.tools.visualvm.core.model.Model;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.File;
import java.io.IOException;
import java.util.Properties;
import java.util.logging.Logger;

public abstract class Jvm
  extends Model
{
  protected static final Logger LOGGER = Logger.getLogger(Jvm.class.getName());
  public static final String PROPERTY_DUMP_OOME_ENABLED = "prop_oome";
  private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
  
  public abstract boolean is14();
  
  public abstract boolean is15();
  
  public abstract boolean is16();
  
  public abstract boolean is17();
  
  public abstract boolean isAttachable();
  
  public abstract boolean isBasicInfoSupported();
  
  public abstract String getCommandLine();
  
  public abstract String getJvmArgs();
  
  public abstract String getJvmFlags();
  
  public abstract String getMainArgs();
  
  public abstract String getMainClass();
  
  public abstract String getVmVersion();
  
  public abstract String getJavaVersion();
  
  public abstract String getJavaHome();
  
  public abstract String getVmInfo();
  
  public abstract String getVmName();
  
  public abstract String getVmVendor();
  
  public abstract boolean is
1 2 3 4

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd