[jbossws-dev] [Design of JBoss Web Services] - Re: Upgrading jboss-bootstrap and WS

ALRubinger do-not-reply at jboss.com
Mon May 18 22:52:23 EDT 2009


And my (untested) patch looks like:

Index: src/main/java/org/jboss/wsf/common/management/AbstractServerConfig.java
  | ===================================================================
  | --- src/main/java/org/jboss/wsf/common/management/AbstractServerConfig.java	(revision 10049)
  | +++ src/main/java/org/jboss/wsf/common/management/AbstractServerConfig.java	(working copy)
  | @@ -23,6 +23,8 @@
  |  
  |  import java.io.File;
  |  import java.net.InetAddress;
  | +import java.net.URISyntaxException;
  | +import java.net.URL;
  |  import java.net.UnknownHostException;
  |  import java.util.Set;
  |  
  | @@ -45,6 +47,12 @@
  |  public abstract class AbstractServerConfig implements AbstractServerConfigMBean, ServerConfig
  |  {
  |     private static final Logger log = Logger.getLogger(AbstractServerConfig.class);
  | +   
  | +   protected static final ObjectName OBJECT_NAME_SERVER_CONFIG;
  | +   static
  | +   {
  | +      OBJECT_NAME_SERVER_CONFIG = ObjectNameFactory.create("jboss.system:type=ServerConfig");
  | +   }
  |  
  |     // The MBeanServer
  |     private MBeanServer mbeanServer;
  | @@ -110,44 +118,56 @@
  |  
  |     public File getServerTempDir()
  |     {
  | -      try
  | -      {
  | -         ObjectName oname = ObjectNameFactory.create("jboss.system:type=ServerConfig");
  | -         File dir = (File)getMbeanServer().getAttribute(oname, "ServerTempDir");
  | -         return dir;
  | -      }
  | -      catch (JMException e)
  | -      {
  | -         return null;
  | -      }
  | +      return this.getDirFromServerConfig("ServerTempLocation");
  |     }
  |     
  |     public File getHomeDir()
  |     {
  | +      return this.getDirFromServerConfig("JBossHome");
  | +   }
  | +
  | +   public File getServerDataDir()
  | +   {
  | +      return this.getDirFromServerConfig("ServerDataLocation");
  | +   }
  | +   
  | +   /**
  | +    * Obtains the specified attribute from the server configuration,
  | +    * represented as a {@link File}.
  | +    *  
  | +    * @param attributeName
  | +    * @return
  | +    * @author ALR
  | +    */
  | +   protected File getDirFromServerConfig(final String attributeName)
  | +   {
  | +      // Define the ON to invoke upon
  | +      final ObjectName on = OBJECT_NAME_SERVER_CONFIG;
  | +
  | +      // Get the URL location
  | +      URL location = null;
  |        try
  |        {
  | -         ObjectName oname = ObjectNameFactory.create("jboss.system:type=ServerConfig");
  | -         File dir = (File)getMbeanServer().getAttribute(oname, "HomeDir");
  | -         return dir;
  | +         location = (URL) getMbeanServer().getAttribute(on, attributeName);
  |        }
  | -      catch (JMException e)
  | +      catch (final JMException e)
  |        {
  | -         return null;
  | +         throw new RuntimeException("Could not obtain attribute " + attributeName + " from " + on, e);
  |        }
  | -   }
  |  
  | -   public File getServerDataDir()
  | -   {
  | +      // Represent as a File
  | +      File dir = null;
  |        try
  |        {
  | -         ObjectName oname = ObjectNameFactory.create("jboss.system:type=ServerConfig");
  | -         File dir = (File)getMbeanServer().getAttribute(oname, "ServerDataDir");
  | -         return dir;
  | +         dir = new File(location.toURI());
  |        }
  | -      catch (JMException e)
  | +      catch (final URISyntaxException urise)
  |        {
  | -         return null;
  | +         throw new RuntimeException("Could not desired directory from URL: " + location, urise);
  |        }
  | +
  | +      // Return
  | +      return dir;
  |     }
  |  
  |     public int getWebServicePort()

S,
ALR

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4231761#4231761

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4231761



More information about the jbossws-dev mailing list