FileDocCategorySizeDatePackage
PWCVirtualServerStatsImpl.javaAPI DocGlassfish v2 API6481Fri May 04 22:36:08 BST 2007com.sun.enterprise.web.stats

PWCVirtualServerStatsImpl

public class PWCVirtualServerStatsImpl extends Object implements com.sun.enterprise.admin.monitor.stats.PWCVirtualServerStats
Class representing Virtual Server stats in PE.

Fields Summary
private static final Logger
_logger
private long
startTime
private com.sun.enterprise.admin.monitor.stats.GenericStatsImpl
baseStatsImpl
private com.sun.enterprise.admin.monitor.stats.StringStatistic
idStats
private com.sun.enterprise.admin.monitor.stats.StringStatistic
modeStats
private com.sun.enterprise.admin.monitor.stats.StringStatistic
hostsStats
private com.sun.enterprise.admin.monitor.stats.StringStatistic
interfacesStats
Constructors Summary
public PWCVirtualServerStatsImpl(com.sun.enterprise.web.VirtualServer vs)


    /*
     * Constructor.
     */
       

        initializeStatistics(vs);

        baseStatsImpl = new GenericStatsImpl(
            com.sun.enterprise.admin.monitor.stats.PWCVirtualServerStats.class,
            this);
    
Methods Summary
public com.sun.enterprise.admin.monitor.stats.StringStatisticgetHosts()
Returns the host names of this virtual server

return
Host names of this virtual server

        return hostsStats;
    
public com.sun.enterprise.admin.monitor.stats.StringStatisticgetId()
Returns the virtual server ID.

return
Virtual server ID

        return idStats;
    
public com.sun.enterprise.admin.monitor.stats.StringStatisticgetInterfaces()
Returns the interfaces of this virtual server

return
Interfaces of this virtual server

        return interfacesStats;
    
public com.sun.enterprise.admin.monitor.stats.StringStatisticgetMode()
Returns the virtual server mode.

return
Virtual server mode

        return modeStats;
    
public javax.management.j2ee.statistics.StatisticgetStatistic(java.lang.String str)

        return baseStatsImpl.getStatistic(str);
    
public java.lang.String[]getStatisticNames()

        return baseStatsImpl.getStatisticNames();
    
public javax.management.j2ee.statistics.Statistic[]getStatistics()

        return baseStatsImpl.getStatistics();
    
private voidinitializeStatistics(com.sun.enterprise.web.VirtualServer vs)
Initializes the stats from the given virtual server

param
vs Virtual server from which to derive stats


        startTime = System.currentTimeMillis();

        // ID
        idStats = new StringStatisticImpl(
                                vs.getID(),
                                "Id",
                                "String",
                                "Virtual Server ID",
                                startTime,
                                startTime);

        // Mode
        modeStats = new StringStatisticImpl(
                                vs.isActive() ? "active" : "unknown",
                                "Mode",
                                "unknown/active",
                                "Virtual Server mode",
                                startTime,
                                startTime);

        // Hosts
        String hosts = null;
        String[] aliases = vs.findAliases();
        if (aliases != null) {
            for (int i=0; i<aliases.length; i++) {
                if (hosts == null) {
                    hosts = aliases[i];
                } else {
                    hosts += ", " + aliases[i];
                }
            }
        }
        hostsStats = new StringStatisticImpl(
                                hosts,
                                "Hosts",
                                "String",
                                "The software virtual hostnames serviced by "
                                + "this Virtual Server",
                                startTime,
                                startTime);

        // Interfaces
        interfacesStats = new StringStatisticImpl(
                                "0.0.0.0", // XXX FIX
                                "Interfaces",
                                "String",
                                "The interfaces for which this Virtual Server "
                                + "has been configured",
                                startTime,
                                startTime);