Examples of RuntimeInformation


Examples of com.googlecode.psiprobe.model.jmx.RuntimeInformation

    public void setRuntimeInfoAccessorBean(RuntimeInfoAccessorBean runtimeInfoAccessorBean) {
        this.runtimeInfoAccessorBean = runtimeInfoAccessorBean;
    }

    public void collect() throws Exception {
        RuntimeInformation ri = runtimeInfoAccessorBean.getRuntimeInformation();
        if (ri != null) {
            long time = System.currentTimeMillis();
            buildAbsoluteStats("os.memory.committed", ri.getCommittedVirtualMemorySize()/1024, time);
            buildAbsoluteStats("os.memory.physical", (ri.getTotalPhysicalMemorySize() - ri.getFreePhysicalMemorySize())/1024, time);
            buildAbsoluteStats("os.memory.swap", (ri.getTotalSwapSpaceSize() - ri.getFreeSwapSpaceSize())/1024, time);
            //
            // processCpuTime is in nano-seconds, to build timePercentageStats both time parameters have to use
            // in the same units.
            //
            buildTimePercentageStats("os.cpu", ri.getProcessCpuTime() / 1000000, time);
        }
    }
View Full Code Here

Examples of com.googlecode.psiprobe.model.jmx.RuntimeInformation

    private Log logger = LogFactory.getLog(RuntimeInfoAccessorBean.class);

    public RuntimeInformation getRuntimeInformation() throws Exception {
        MBeanServer mBeanServer = new Registry().getMBeanServer();
        RuntimeInformation ri = new RuntimeInformation();

        try {
            ObjectName runtimeOName = new ObjectName("java.lang:type=Runtime");
            ri.setStartTime(JmxTools.getLongAttr(mBeanServer, runtimeOName, "StartTime"));
            ri.setUptime(JmxTools.getLongAttr(mBeanServer, runtimeOName, "Uptime"));
            ri.setVmVendor(JmxTools.getStringAttr(mBeanServer,runtimeOName,"VmVendor"));

            ObjectName osOName = new ObjectName("java.lang:type=OperatingSystem");
            ri.setOsName(JmxTools.getStringAttr(mBeanServer, osOName, "Name"));
            ri.setOsVersion(JmxTools.getStringAttr(mBeanServer, osOName, "Version"));

            if(!ri.getVmVendor().startsWith("IBM Corporation")){
                ri.setTotalPhysicalMemorySize(JmxTools.getLongAttr(mBeanServer, osOName, "TotalPhysicalMemorySize"));
                ri.setCommittedVirtualMemorySize(JmxTools.getLongAttr(mBeanServer, osOName, "CommittedVirtualMemorySize"));
                ri.setFreePhysicalMemorySize(JmxTools.getLongAttr(mBeanServer, osOName, "FreePhysicalMemorySize"));
                ri.setFreeSwapSpaceSize(JmxTools.getLongAttr(mBeanServer, osOName, "FreeSwapSpaceSize"));
                ri.setTotalSwapSpaceSize(JmxTools.getLongAttr(mBeanServer, osOName, "TotalSwapSpaceSize"));
                ri.setProcessCpuTime(JmxTools.getLongAttr(mBeanServer, osOName, "ProcessCpuTime"));
            } else {
                ri.setTotalPhysicalMemorySize(JmxTools.getLongAttr(mBeanServer, osOName, "TotalPhysicalMemory"));
            }

            return ri;
        } catch (Exception e) {
            logger.debug("OS information is unavailable");
View Full Code Here

Examples of org.apache.maven.execution.RuntimeInformation

    public void execute( EnforcerRuleHelper helper )
        throws EnforcerRuleException
    {
        try
        {
            RuntimeInformation rti = (RuntimeInformation) helper.getComponent( RuntimeInformation.class );
            ArtifactVersion detectedMavenVersion = rti.getApplicationVersion();
            helper.getLog().debug( "Detected Maven Version: " + detectedMavenVersion );
            enforceVersion( helper.getLog(), "Maven", getVersion(), detectedMavenVersion );
        }
        catch ( ComponentLookupException e )
        {
View Full Code Here

Examples of org.apache.maven.execution.RuntimeInformation

            String target = (String) helper.evaluate( "${project.build.directory}" );
            String artifactId = (String) helper.evaluate( "${project.artifactId}" );

            // retreive any component out of the session directly
            ArtifactResolver resolver = (ArtifactResolver) helper.getComponent( ArtifactResolver.class );
            RuntimeInformation rti = (RuntimeInformation) helper.getComponent( RuntimeInformation.class );

            log.info( "Retrieved Target Folder: " + target );
            log.info( "Retrieved ArtifactId: " +artifactId );
            log.info( "Retrieved Project: " + project );
            log.info( "Retrieved RuntimeInfo: " + rti );
View Full Code Here

Examples of org.apache.maven.execution.RuntimeInformation

        try
        {
            EnforcerExpressionEvaluator evaluator = new EnforcerExpressionEvaluator( session, translator, project );
            DefaultEnforcementRuleHelper helper = new DefaultEnforcementRuleHelper( session, evaluator, getLog(),
                                                                                    container );
            RuntimeInformation rti = (RuntimeInformation) helper.getComponent( RuntimeInformation.class );
            getLog().info( "Maven Version: " + rti.getApplicationVersion() );
            getLog().info( "JDK Version: " + SystemUtils.JAVA_VERSION + " normalized as: "
                               + RequireJavaVersion.normalizeJDKVersion( SystemUtils.JAVA_VERSION_TRIMMED ) );
            RequireOS os = new RequireOS();
            os.displayOSInfo( getLog(), true );
View Full Code Here

Examples of org.apache.maven.execution.RuntimeInformation

    public void execute( EnforcerRuleHelper helper )
        throws EnforcerRuleException
    {
        try
        {
            RuntimeInformation rti = (RuntimeInformation) helper.getComponent( RuntimeInformation.class );
            ArtifactVersion detectedMavenVersion = rti.getApplicationVersion();
            helper.getLog().debug( "Detected Maven Version: " + detectedMavenVersion );
            enforceVersion( helper.getLog(), "Maven", this.version, detectedMavenVersion );
        }
        catch ( ComponentLookupException e )
        {
View Full Code Here

Examples of org.apache.maven.execution.RuntimeInformation

        try
        {
            EnforcerExpressionEvaluator evaluator = new EnforcerExpressionEvaluator( session, translator, project );
            DefaultEnforcementRuleHelper helper = new DefaultEnforcementRuleHelper( session, evaluator, getLog(),
                                                                                    container );
            RuntimeInformation rti = (RuntimeInformation) helper.getComponent( RuntimeInformation.class );
            getLog().info( "Maven Version: " + rti.getApplicationVersion() );
            getLog().info( "JDK Version: " + SystemUtils.JAVA_VERSION + " normalized as: "
                               + RequireJavaVersion.normalizeJDKVersion( SystemUtils.JAVA_VERSION_TRIMMED ) );
            RequireOS os = new RequireOS();
            os.displayOSInfo( getLog(), true );
        }
View Full Code Here

Examples of org.apache.maven.execution.RuntimeInformation

        try
        {
            EnforcerExpressionEvaluator evaluator = new EnforcerExpressionEvaluator( session, translator, project );
            DefaultEnforcementRuleHelper helper = new DefaultEnforcementRuleHelper( session, evaluator, getLog(),
                                                                                    container );
            RuntimeInformation rti = (RuntimeInformation) helper.getComponent( RuntimeInformation.class );
            getLog().info( "Maven Version: " + rti.getApplicationVersion() );
            getLog().info( "JDK Version: " + SystemUtils.JAVA_VERSION + " normalized as: "
                               + RequireJavaVersion.normalizeJDKVersion( SystemUtils.JAVA_VERSION_TRIMMED ) );
            RequireOS os = new RequireOS();
            os.displayOSInfo( getLog(), true );
View Full Code Here

Examples of org.apache.maven.execution.RuntimeInformation

            String target = (String) helper.evaluate( "${project.build.directory}" );
            String artifactId = (String) helper.evaluate( "${project.artifactId}" );

            // retreive any component out of the session directly
            ArtifactResolver resolver = (ArtifactResolver) helper.getComponent( ArtifactResolver.class );
            RuntimeInformation rti = (RuntimeInformation) helper.getComponent( RuntimeInformation.class );

            log.info( "Retrieved Target Folder: " + target );
            log.info( "Retrieved ArtifactId: " +artifactId );
            log.info( "Retrieved Project: " + project );
            log.info( "Retrieved RuntimeInfo: " + rti );
View Full Code Here

Examples of org.apache.maven.rtinfo.RuntimeInformation

{

    public void testGetMavenVersion()
        throws Exception
    {
        RuntimeInformation rtInfo = lookup( RuntimeInformation.class );

        String mavenVersion = rtInfo.getMavenVersion();
        assertNotNull( mavenVersion );
        assertTrue( mavenVersion.length() > 0 );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.