User: user57  
  Date: 02/04/03 18:53:14

  Modified:    src/main/org/jboss/system/server ServerConfigImpl.java
                        ServerImpl.java ServerInfo.java
  Removed:     src/main/org/jboss/system/server ServerConfigImplMBean.java
                        ServerImplMBean.java ServerInfoMBean.java
  Log:
   o Using XDoclet to generate *MBean interfaces
  
  Revision  Changes    Path
  1.4       +92 -1     
jboss-system/src/main/org/jboss/system/server/ServerConfigImpl.java
  
  Index: ServerConfigImpl.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss-system/src/main/org/jboss/system/server/ServerConfigImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ServerConfigImpl.java     27 Feb 2002 09:24:26 -0000      1.3
  +++ ServerConfigImpl.java     4 Apr 2002 02:53:14 -0000       1.4
  @@ -31,8 +31,10 @@
    * <p>Most values are determined durring first call to getter.  All values
    *    when determined will have equivilent system properties set.
    *
  + * @jmx:mbean name="jboss.system:type=ServerConfig"
  + *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
  - * @version $Revision: 1.3 $
  + * @version <tt>$Revision: 1.4 $</tt>
    */
   public class ServerConfigImpl
      implements ServerConfig, ServerConfigImplMBean
  @@ -122,16 +124,31 @@
      //                             Typed Access                            //
      /////////////////////////////////////////////////////////////////////////
   
  +   /**
  +    * Get the local home directory which the server is running from.
  +    *
  +    * @jmx:managed-operation
  +    */
      public File getHomeDir() 
      {
         return homeDir;
      }
   
  +   /**
  +    * Get the home URL which the server is running from.
  +    *
  +    * @jmx:managed-operation
  +    */
      public URL getHomeURL()
      {
         return homeURL;
      }
   
  +   /**
  +    * Get the home URL which the server is running from.
  +    * 
  +    * @jmx:managed-operation
  +    */
      public URL getLibraryURL() 
      {
         if (libraryURL == null) {
  @@ -149,6 +166,11 @@
         return libraryURL;
      }
   
  +   /**
  +    * Get the patch URL for the server.
  +    *
  +    * @jmx:managed-operation
  +    */
      public URL getPatchURL() 
      {
         if (patchURL == null) {
  @@ -172,6 +194,11 @@
         return (URL)patchURL;
      }
   
  +   /**
  +    * Get the name of the server.
  +    *
  +    * @jmx:managed-operation
  +    */
      public String getServerName()
      {
         if (serverName == null) {
  @@ -181,6 +208,11 @@
         return serverName;
      }
   
  +   /**
  +    * Get the base directory for calculating server home directories.
  +    *
  +    * @jmx:managed-operation
  +    */
      public File getServerBaseDir()
      {
         if (serverBaseDir == null) {
  @@ -193,6 +225,11 @@
         return serverBaseDir;
      }
   
  +   /**
  +    * Get the server home directory.
  +    *
  +    * @jmx:managed-operation
  +    */
      public File getServerHomeDir() {
         if (serverHomeDir == null) {
            serverHomeDir = getFile(ServerConfig.SERVER_HOME_DIR);
  @@ -204,6 +241,11 @@
         return serverHomeDir;
      }
   
  +   /**
  +    * Get the directory where temporary files will be stored.
  +    *
  +    * @jmx:managed-operation
  +    */
      public File getServerTempDir()
      {
         if (serverTempDir == null) {
  @@ -216,6 +258,11 @@
         return serverTempDir;
      }
   
  +   /**
  +    * Get the directory where local data will be stored.
  +    *
  +    * @jmx:managed-operation
  +    */
      public File getServerDataDir()
      {
         if (serverDataDir == null) {
  @@ -228,6 +275,11 @@
         return serverDataDir;
      }
   
  +   /**
  +    * Get the base directory for calculating server home URLs.
  +    *
  +    * @jmx:managed-operation
  +    */
      public URL getServerBaseURL()
      {
         if (serverBaseURL == null) {
  @@ -245,6 +297,11 @@
         return serverBaseURL;
      }
   
  +   /**
  +    * Get the server home URL.
  +    *
  +    * @jmx:managed-operation
  +    */
      public URL getServerHomeURL()
      {
         if (serverHomeURL == null) {
  @@ -262,6 +319,11 @@
         return serverHomeURL;
      }
   
  +   /**
  +    * Get the server library URL.
  +    *
  +    * @jmx:managed-operation
  +    */
      public URL getServerLibraryURL()
      {
         if (serverLibraryURL == null) {
  @@ -279,6 +341,11 @@
         return serverLibraryURL;
      }
   
  +   /**
  +    * Get the server configuration URL.
  +    *
  +    * @jmx:managed-operation
  +    */
      public URL getServerConfigURL()
      {
         if (serverConfigURL == null) {
  @@ -296,6 +363,15 @@
         return serverConfigURL;
      }
   
  +   /**
  +    * Enable or disable exiting the JVM when {@link Server#shutdown} is called.
  +    * If enabled, then shutdown calls {@link Server#exit}.  If disabled, then
  +    * only the shutdown hook will be run.
  +    *
  +    * @param flag    True to enable calling exit on shutdown.
  +    *
  +    * @jmx:managed-operation
  +    */
      public void setExitOnShutdown(final boolean flag) {
         if (exitOnShutdown == null) {
            exitOnShutdown = new MuBoolean(flag);
  @@ -305,6 +381,13 @@
         }
      }
   
  +   /**
  +    * Get the current value of the exit on shutdown flag.
  +    *
  +    * @return    The current value of the exit on shutdown flag.
  +    *
  +    * @jmx:managed-operation
  +    */
      public boolean getExitOnShutdown() {
         if (exitOnShutdown == null) {
            String value = props.getProperty(ServerConfig.EXIT_ON_SHUTDOWN, null);
  @@ -326,6 +409,8 @@
   
      /**
       * @deprecated
  +    *
  +    * @jmx:managed-operation
       */
      public URL getInstallURL()
      {
  @@ -334,6 +419,8 @@
   
      /**
       * @deprecated
  +    *
  +    * @jmx:managed-operation
       */
      public URL getConfigURL()
      {
  @@ -342,6 +429,8 @@
   
      /**
       * @deprecated
  +    *
  +    * @jmx:managed-operation
       */
      public File getDataDir()
      {
  @@ -350,6 +439,8 @@
   
      /**
       * @deprecated
  +    *
  +    * @jmx:managed-operation
       */
      public File getTempDir()
      {
  
  
  
  1.12      +54 -1     jboss-system/src/main/org/jboss/system/server/ServerImpl.java
  
  Index: ServerImpl.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss-system/src/main/org/jboss/system/server/ServerImpl.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ServerImpl.java   3 Apr 2002 08:27:27 -0000       1.11
  +++ ServerImpl.java   4 Apr 2002 02:53:14 -0000       1.12
  @@ -43,9 +43,11 @@
    * <h3>Concurrency</h3>
    * This class is <b>not</b> thread-safe.
    *
  + * @jmx:mbean name="jboss.system:type=Server"
  + *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
  - * @version $Revision: 1.11 $
  + * @version $Revision: 1.12 $
    */
   public class ServerImpl
      implements Server, ServerImplMBean
  @@ -426,6 +428,8 @@
       * <p>If the exit on shutdown flag is true, then {@link #exit} 
       *    is called, else only the shutdown hook is run.
       *
  +    * @jmx:managed-operation
  +    *
       * @throws IllegalStateException    No started.
       */
      public void shutdown() throws IllegalStateException
  @@ -466,6 +470,8 @@
      /**
       * Shutdown the server, the JVM and run shutdown hooks.
       *
  +    * @jmx:managed-operation
  +    *
       * @param exitcode   The exit code returned to the operating system.
       */
      public void exit(final int exitcode)
  @@ -485,6 +491,8 @@
      /**
       * Shutdown the server, the JVM and run shutdown hooks.  Exits with
       * code 1.
  +    *
  +    * @jmx:managed-operation
       */
      public void exit()
      {
  @@ -495,6 +503,8 @@
       * Forcibly terminates the currently running Java virtual machine.
       *
       * @param exitcode   The exit code returned to the operating system.
  +    *
  +    * @jmx:managed-operation
       */
      public void halt(final int exitcode)
      {
  @@ -513,6 +523,8 @@
      /**
       * Forcibly terminates the currently running Java virtual machine.
       * Exits with code 1.
  +    *
  +    * @jmx:managed-operation
       */
      public void halt()
      {
  @@ -530,6 +542,11 @@
         log.info("Total/free memory: " + rt.totalMemory() + "/" + rt.freeMemory());
      }
      
  +   /**
  +    * Hint to the JVM to run the garbage collector.
  +    *
  +    * @jmx:managed-operation
  +    */
      public void runGarbageCollector()
      {
         Runtime rt = Runtime.getRuntime();
  @@ -540,6 +557,11 @@
         logMemoryUsage(rt);
      }
      
  +   /**
  +    * Hint to the JVM to run any pending object finailizations.
  +    *
  +    * @jmx:managed-operation
  +    */
      public void runFinalization()
      {
         Runtime.getRuntime().runFinalization();
  @@ -548,6 +570,8 @@
      
      /**
       * Enable or disable tracing method calls at the Runtime level.
  +    *
  +    * @jmx:managed-operation
       */
      public void traceMethodCalls(final Boolean flag)
      {
  @@ -556,6 +580,8 @@
      
      /**
       * Enable or disable tracing instructions the Runtime level.
  +    *
  +    * @jmx:managed-operation
       */
      public void traceInstructions(final Boolean flag)
      {
  @@ -567,21 +593,33 @@
      //                          Server Information                           //
      ///////////////////////////////////////////////////////////////////////////
      
  +   /**
  +    * @jmx:managed-operation
  +    */
      public Date getStartDate()
      {
         return startDate;
      }
      
  +   /**
  +    * @jmx:managed-operation
  +    */
      public Long getTotalMemory()
      {
         return new Long(Runtime.getRuntime().totalMemory());
      }
      
  +   /**
  +    * @jmx:managed-operation
  +    */
      public Long getFreeMemory()
      {
         return new Long(Runtime.getRuntime().freeMemory());
      }
      
  +   /**
  +    * @jmx:managed-operation
  +    */
      public Long getMaxMemory()
      {
         // Uncomment when JDK 1.4 is the base JVM
  @@ -589,26 +627,41 @@
         return new Long(-1);
      }
      
  +   /**
  +    * @jmx:managed-operation
  +    */
      public String getVersion()
      {
         return version.toString();
      }
      
  +   /**
  +    * @jmx:managed-operation
  +    */
      public String getVersionName()
      {
         return version.getName();
      }
      
  +   /**
  +    * @jmx:managed-operation
  +    */
      public String getBuildNumber()
      {
         return version.getBuildNumber();
      }
      
  +   /**
  +    * @jmx:managed-operation
  +    */
      public String getBuildID()
      {
         return version.getBuildID();
      }
      
  +   /**
  +    * @jmx:managed-operation
  +    */
      public String getBuildDate()
      {
         return version.getBuildDate();
  
  
  
  1.3       +79 -46    jboss-system/src/main/org/jboss/system/server/ServerInfo.java
  
  Index: ServerInfo.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss-system/src/main/org/jboss/system/server/ServerInfo.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServerInfo.java   26 Feb 2002 01:36:24 -0000      1.2
  +++ ServerInfo.java   4 Apr 2002 02:53:14 -0000       1.3
  @@ -26,12 +26,14 @@
    * An MBean that provides a rich view of system information for the JBoss
    * server in which it is deployed.
    *
  + * @jmx:mbean name="jboss.system:type=ServerInfo"
  + *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Rickard Öberg</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Hiram Chirino</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class ServerInfo
      implements ServerInfoMBean, MBeanRegistration
  @@ -103,6 +105,11 @@
      //                            Server Information                         //
      ///////////////////////////////////////////////////////////////////////////
      
  +   /**
  +    * Returns InetAddress.getLocalHost().getHostName();
  +    *
  +    * @jmx:managed-operation
  +    */
      public String getHostName()
      {
         if (hostName == null)
  @@ -121,6 +128,11 @@
         return hostName;
      }
      
  +   /**
  +    * Returns InetAddress.getLocalHost().getHostAddress();
  +    *
  +    * @jmx:managed-operation
  +    */
      public String getHostAddress()
      {
         if (hostAddress == null)
  @@ -139,7 +151,10 @@
         return hostAddress;
      }
   
  -   /** Return the total memory and free memory from Runtime
  +   /**
  +    * Return the total memory and free memory from Runtime
  +    *
  +    * @jmx:managed-operation
       */
      public String listMemoryUsage()
      {
  @@ -150,7 +165,10 @@
         return rc;
      }
   
  -   /** Return a listing of the active threads and thread groups.
  +   /**
  +    * Return a listing of the active threads and thread groups.
  +    *
  +    * @jmx:managed-operation
       */
      public String listThreadDump()
      {
  @@ -175,7 +193,46 @@
         return rc;
      }
   
  -   /** Display the java.lang.Package info for the pkgName  */
  +
  +   private String getThreadGroupInfo(ThreadGroup group)
  +   {
  +      StringBuffer rc = new StringBuffer();
  +      
  +      rc.append("<BR><B>");
  +      rc.append("Thread Group: " + group.getName());
  +      rc.append("</B> : ");
  +      rc.append("max priority:" + group.getMaxPriority() +
  +      ", demon:" + group.isDaemon());
  +      
  +      rc.append("<blockquote>");
  +      Thread threads[]= new Thread[group.activeCount()];
  +      group.enumerate(threads, false);
  +      for (int i= 0; i < threads.length && threads[i] != null; i++)
  +      {
  +         rc.append("<B>");
  +         rc.append("Thread: " + threads[i].getName());
  +         rc.append("</B> : ");
  +         rc.append("priority:" + threads[i].getPriority() +
  +         ", demon:" + threads[i].isDaemon());
  +         rc.append("<BR>");
  +      }
  +      
  +      ThreadGroup groups[]= new ThreadGroup[group.activeGroupCount()];
  +      group.enumerate(groups, false);
  +      for (int i= 0; i < groups.length && groups[i] != null; i++)
  +      {
  +         rc.append(getThreadGroupInfo(groups[i]));
  +      }
  +      rc.append("</blockquote>");
  +      
  +      return rc.toString();
  +   }
  +
  +   /**
  +    * Display the java.lang.Package info for the pkgName
  +    *
  +    * @jmx:managed-operation
  +    */
      public String displayPackageInfo(String pkgName)
      {
         Package pkg = Package.getPackage(pkgName);
  @@ -186,9 +243,14 @@
         displayPackageInfo(pkg, info);
         return info.toString();
      }
  -   /** Display the ClassLoader, ProtectionDomain and Package information for
  -    the specified class.
  -    @return a simple html report of this information
  +
  +   /** 
  +    * Display the ClassLoader, ProtectionDomain and Package information for
  +    * the specified class.
  +    *
  +    * @return a simple html report of this information
  +    *
  +    * @jmx:managed-operation
       */
      public String displayInfoForClass(String className)
      {
  @@ -210,9 +272,10 @@
         return info.toString();
      }
   
  -   /** This does not work as expected because the thread context class loader
  -    *is not used to determine which class loader the package list is obtained
  -    *from.
  +   /** 
  +    * This does not work as expected because the thread context class loader
  +    * is not used to determine which class loader the package list is obtained
  +    * from.
       */
      public String displayAllPackageInfo()
      {
  @@ -242,6 +305,7 @@
         Thread.currentThread().setContextClassLoader(entryCL);
         return info.toString();
      }
  +
      private void displayPackageInfo(Package pkg, StringBuffer info)
      {
         info.append("<pre>\n");
  @@ -257,15 +321,19 @@
   
      /**
       * Get a single system property.
  +    *
  +    * @jmx:managed-operation
       */
      public String getProperty(String name)
      {
         return System.getProperty(name);
      }
   
  -   /** 
  +   /**
       * Return a Map of System.getProperties() with a toString implementation
       * that provides an html table of the key/value pairs
  +    *
  +    * @jmx:managed-operation
       */
      public Map showProperties()
      {
  @@ -291,39 +359,4 @@
            }
         };
      }
  -
  -   private String getThreadGroupInfo(ThreadGroup group)
  -   {
  -      StringBuffer rc = new StringBuffer();
  -      
  -      rc.append("<BR><B>");
  -      rc.append("Thread Group: " + group.getName());
  -      rc.append("</B> : ");
  -      rc.append("max priority:" + group.getMaxPriority() +
  -      ", demon:" + group.isDaemon());
  -      
  -      rc.append("<blockquote>");
  -      Thread threads[]= new Thread[group.activeCount()];
  -      group.enumerate(threads, false);
  -      for (int i= 0; i < threads.length && threads[i] != null; i++)
  -      {
  -         rc.append("<B>");
  -         rc.append("Thread: " + threads[i].getName());
  -         rc.append("</B> : ");
  -         rc.append("priority:" + threads[i].getPriority() +
  -         ", demon:" + threads[i].isDaemon());
  -         rc.append("<BR>");
  -      }
  -      
  -      ThreadGroup groups[]= new ThreadGroup[group.activeGroupCount()];
  -      group.enumerate(groups, false);
  -      for (int i= 0; i < groups.length && groups[i] != null; i++)
  -      {
  -         rc.append(getThreadGroupInfo(groups[i]));
  -      }
  -      rc.append("</blockquote>");
  -      
  -      return rc.toString();
  -   }
  -
   }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to