[jboss-cvs] JBossAS SVN: r84689 - projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 24 21:14:47 EST 2009


Author: ALRubinger
Date: 2009-02-24 21:14:47 -0500 (Tue, 24 Feb 2009)
New Revision: 84689

Modified:
   projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/AbstractServerImpl.java
   projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/BaseServerConfig.java
Log:
[JBBOOT-13] Reapply r81835 by Scott - "JBAS-5529, JBAS-5523, core server managed objects and state information"

Modified: projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/AbstractServerImpl.java
===================================================================
--- projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/AbstractServerImpl.java	2009-02-25 01:48:27 UTC (rev 84688)
+++ projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/AbstractServerImpl.java	2009-02-25 02:14:47 UTC (rev 84689)
@@ -40,6 +40,7 @@
 import org.jboss.bootstrap.spi.ServerConfig;
 import org.jboss.bootstrap.spi.ServerProcess;
 import org.jboss.logging.Logger;
+import org.jboss.managed.api.annotation.ManagementProperty;
 import org.jboss.net.protocol.URLStreamHandlerFactory;
 import org.jboss.util.StopWatch;
 import org.jboss.virtual.VirtualFile;
@@ -325,6 +326,7 @@
     * @return          Typed server configuration object.
     * @throws IllegalStateException    Not initialized.
     */
+   @ManagementProperty(managed=true)
    public ServerConfig getConfig() throws IllegalStateException
    {
       if (config == null)
@@ -740,41 +742,49 @@
 //                             Server Information                        //
 ///////////////////////////////////////////////////////////////////////////
 
+   @ManagementProperty(description="The server start time")
    public Date getStartDate()
    {
       return startDate;
    }
 
+   @ManagementProperty(description="The server version string")
    public String getVersion()
    {
       return version.toString();
    }
 
+   @ManagementProperty(description="The server version name")
    public String getVersionName()
    {
       return version.getName();
    }
 
+   @ManagementProperty(description="The server version number string")
    public String getVersionNumber()
    {
       return version.getVersionNumber();
    }
 
+   @ManagementProperty(description="The server build number")
    public String getBuildNumber()
    {
       return version.getBuildNumber();
    }
 
+   @ManagementProperty(description="The server build JVM")
    public String getBuildJVM()
    {
       return version.getBuildJVM();
    }
 
+   @ManagementProperty(description="The server build OS")
    public String getBuildOS()
    {
       return version.getBuildOS();
    }
 
+   @ManagementProperty(description="The server build ID")
    public String getBuildID()
    {
       return version.getBuildID();
@@ -784,6 +794,7 @@
     * The server build date
     * @return server build date
     */
+   @ManagementProperty(description="The server build date")
    public String getBuildDate()
    {
       return version.getBuildDate();

Modified: projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/BaseServerConfig.java
===================================================================
--- projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/BaseServerConfig.java	2009-02-25 01:48:27 UTC (rev 84688)
+++ projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/BaseServerConfig.java	2009-02-25 02:14:47 UTC (rev 84689)
@@ -21,7 +21,9 @@
  */
 package org.jboss.bootstrap;
 
+import java.io.File;
 import java.io.IOException;
+import java.lang.reflect.Type;
 import java.net.MalformedURLException;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -29,6 +31,18 @@
 
 import org.jboss.bootstrap.spi.Server;
 import org.jboss.bootstrap.spi.ServerConfig;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ViewUse;
+import org.jboss.metatype.api.annotations.MetaMapping;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.spi.values.MetaMapper;
 import org.jboss.util.NestedRuntimeException;
 import org.jboss.util.Null;
 import org.jboss.util.Primitives;
@@ -52,6 +66,11 @@
  * @author Scott.Stark at jboss.org
  * @version <tt>$Revision: 41281 $</tt>
  */
+ at ManagementObject(name = "jboss.system:type=ServerConfig", 
+      isRuntime = true, 
+      properties = ManagementProperties.EXPLICIT, 
+      description = "provides a view of server config information", 
+      componentType = @ManagementComponent(type = "MCBean", subtype = "*"))
 public class BaseServerConfig implements ServerConfig
 {
    /** The configuration properties to pull data from. */
@@ -146,6 +165,8 @@
    //                             Typed Access                            //
    /////////////////////////////////////////////////////////////////////////
 
+   @ManagementProperty(description = "the bootstrap url",
+         use={ViewUse.STATISTIC})
    public URL getBootstrapURL()
    {
       if (bootstrapURL == null)
@@ -165,16 +186,23 @@
       return bootstrapURL;
    }
 
+   @ManagementProperty(description = "the local home directory which the server is running from", use =
+   {ViewUse.STATISTIC})
+   @MetaMapping(FileMetaMapper.class)
    public VirtualFile getHomeDir()
    {
       return homeDir;
    }
 
+   @ManagementProperty(description="home URL which the server is running from",
+         use={ViewUse.STATISTIC})
    public URL getHomeURL()
    {
       return homeURL;
    }
 
+   @ManagementProperty(description="the bootstrap library URL for the server.",
+         use={ViewUse.STATISTIC})
    public URL getLibraryURL()
    {
       if (libraryURL == null)
@@ -224,6 +252,8 @@
       return (URL) patchURL;
    }
 
+   @ManagementProperty(description="the name of the active profile the sever is using",
+         use={ViewUse.STATISTIC})
    public String getServerName()
    {
       if (serverName == null)
@@ -234,6 +264,9 @@
       return serverName;
    }
 
+   @ManagementProperty(description="the base directory for calculating server home directories",
+         use={ViewUse.STATISTIC})
+   @MetaMapping(FileMetaMapper.class)
    public VirtualFile getServerBaseDir()
    {
       if (serverBaseDir == null)
@@ -255,6 +288,9 @@
       return serverBaseDir;
    }
 
+   @ManagementProperty(description="the server home directory",
+         use={ViewUse.STATISTIC})
+   @MetaMapping(FileMetaMapper.class)
    public VirtualFile getServerHomeDir()
    {
       if (serverHomeDir == null)
@@ -284,6 +320,9 @@
     * @see ServerConfig#SERVER_LOG_DIR
     * @return the writable temp directory
     */
+   @ManagementProperty(description="the server log directory",
+         use={ViewUse.STATISTIC})
+   @MetaMapping(FileMetaMapper.class)
    public VirtualFile getServerLogDir()
    {
       if (serverLogDir == null)
@@ -310,6 +349,9 @@
     *
     * @return the writable temp directory
     */
+   @ManagementProperty(description="the directory where temporary files will be stored",
+         use={ViewUse.STATISTIC})
+   @MetaMapping(FileMetaMapper.class)
    public VirtualFile getServerTempDir()
    {
       if (serverTempDir == null)
@@ -336,6 +378,9 @@
     *
     * @return the data directory
     */
+   @ManagementProperty(description="the directory where local data will be stored",
+         use={ViewUse.STATISTIC})
+   @MetaMapping(FileMetaMapper.class)
    public VirtualFile getServerDataDir()
    {
       if (serverDataDir == null)
@@ -362,6 +407,9 @@
     * 
     * @return the directory
     */
+   @ManagementProperty(description="the directory for platform native files",
+         use={ViewUse.STATISTIC})
+   @MetaMapping(FileMetaMapper.class)
    public VirtualFile getServerNativeDir()
    {
       try
@@ -399,6 +447,9 @@
     * 
     * @return the directory
     */
+   @ManagementProperty(description="the temporary deployment dir",
+         use={ViewUse.STATISTIC})
+   @MetaMapping(FileMetaMapper.class)
    public VirtualFile getServerTempDeployDir()
    {
       try
@@ -411,6 +462,8 @@
       }
    }
 
+   @ManagementProperty(description="the base URL for calculating server home URLs",
+         use={ViewUse.STATISTIC})
    public URL getServerBaseURL()
    {
       if (serverBaseURL == null)
@@ -432,6 +485,8 @@
       return serverBaseURL;
    }
 
+   @ManagementProperty(description="the server home URL",
+         use={ViewUse.STATISTIC})
    public URL getServerHomeURL()
    {
       if (serverHomeURL == null)
@@ -453,6 +508,8 @@
       return serverHomeURL;
    }
 
+   @ManagementProperty(description="the server home URL",
+         use={ViewUse.STATISTIC})
    public URL getServerLibraryURL()
    {
       if (serverLibraryURL == null)
@@ -474,6 +531,8 @@
       return serverLibraryURL;
    }
 
+   @ManagementProperty(description="the common library URL base",
+         use={ViewUse.STATISTIC})
    public URL getCommonBaseURL()
    {
       if (commonBaseURL == null)
@@ -495,6 +554,8 @@
       return commonBaseURL;
    }
    
+   @ManagementProperty(description="the URL for the common library jars",
+         use={ViewUse.STATISTIC})
    public URL getCommonLibraryURL()
    {
       if (commonLibraryURL == null)
@@ -516,6 +577,7 @@
       return commonLibraryURL;
    }
    
+   
    public URL getServerConfigURL()
    {
       if (serverConfigURL == null)
@@ -713,6 +775,8 @@
     *
     * @return    The filename of the root deployable.
     */
+   @ManagementProperty(description="the filename of the root deployable that will be used to finalize the bootstrap process",
+         use={ViewUse.STATISTIC})
    public String getRootDeploymentFilename()
    {
       if (rootDeployableFilename == null)
@@ -763,8 +827,46 @@
       return null;
    }
 
+   @ManagementProperty(description="the server Specification-Version",
+         use={ViewUse.STATISTIC})
    public String getSpecificationVersion()
    {
       return serverSpecificationVersion;
    }
+   
+   /**
+    * TODO: move to managed project, JBMAN-49
+    */
+   public static class FileMetaMapper extends MetaMapper<File>
+   {
+      @Override
+      public MetaValue createMetaValue(MetaType metaType, File object)
+      {
+         return SimpleValueSupport.wrap(object.getAbsolutePath());
+      }
+
+      @Override
+      public MetaType getMetaType()
+      {
+         return SimpleMetaType.STRING;
+      }
+
+      @Override
+      public Type mapToType()
+      {
+         return File.class;
+      }
+
+      @Override
+      public File unwrapMetaValue(MetaValue metaValue)
+      {
+         SimpleValue svalue = (SimpleValue) metaValue;
+         File f = null;
+         if (svalue != null)
+         {
+            f = new File(svalue.getValue().toString());
+         }
+         return f;
+      }
+   }
 }




More information about the jboss-cvs-commits mailing list