[jboss-cvs] JBossAS SVN: r76538 - projects/server-manager/trunk/src/main/java/org/jboss/jbossas/servermanager.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 31 18:00:07 EDT 2008


Author: smcgowan at redhat.com
Date: 2008-07-31 18:00:07 -0400 (Thu, 31 Jul 2008)
New Revision: 76538

Modified:
   projects/server-manager/trunk/src/main/java/org/jboss/jbossas/servermanager/Server.java
Log:
JBASM-4 - added methods for JBossTM AS crash testing

Modified: projects/server-manager/trunk/src/main/java/org/jboss/jbossas/servermanager/Server.java
===================================================================
--- projects/server-manager/trunk/src/main/java/org/jboss/jbossas/servermanager/Server.java	2008-07-31 21:47:46 UTC (rev 76537)
+++ projects/server-manager/trunk/src/main/java/org/jboss/jbossas/servermanager/Server.java	2008-07-31 22:00:07 UTC (rev 76538)
@@ -28,6 +28,10 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Properties;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
 
 /**
  * A Server.
@@ -88,6 +92,9 @@
    /** Is there a servlet engine? **/
    private boolean hasWebServer = true;
 
+   /** the Naming Context */
+   private Context namingContext;
+
    /**
     * Get the name.
     *
@@ -225,6 +232,20 @@
    }
 
    /**
+    * Get a single system property.
+    *
+    * @return a System property 
+    */
+   public String getSysProperty(String key)
+   {
+      for (Property property : sysProperties)
+            if (key.equals(property.getKey()))
+                return property.getValue();
+
+      return null; 
+   }
+
+   /**
     * Get the system properties for the command line.
     *
     * @return the properties as a string
@@ -364,6 +385,16 @@
    }
 
    /**
+    * Get the httpPort.
+    *
+    * @return the http port
+    */
+   public Integer getHttpPort()
+   {
+      return httpPort;
+   }
+
+   /**
     * Set the httpPort.
     *
     * @param httpPort The httpPort to set.
@@ -469,7 +500,7 @@
    public void setErrorWriter(PrintWriter errorlog)
    {
       errorWriter = errorlog;
-   }
+    }
 
    /**
     * Get the hasWebServer.
@@ -478,8 +509,9 @@
     */
    public boolean hasWebServer()
    {
-      return hasWebServer;
+	return hasWebServer;
    }
+
    /**
     * Set the hasWebServer.
     *
@@ -490,4 +522,34 @@
       this.hasWebServer = hasWebServer;
    }
 
-}
\ No newline at end of file
+   /**
+    * Get the Naming Context.
+    *
+    * @return the namingContext.
+    */
+   public Context getNamingContext() throws NamingException
+   {
+       if (namingContext == null)
+       {
+          Properties properties = new Properties();
+          properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, ("org.jboss.naming.NamingContextFactory"));
+          properties.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
+          properties.setProperty(Context.PROVIDER_URL, "jnp://"+ getHost() + ':' + getRmiPort());
+
+          setNamingContext(new InitialContext(properties));
+        }
+
+        return namingContext; 
+   }
+
+   /**
+    * Set the NamingContext in case the default is inadequate.
+    *
+    * @param namingContext
+    */
+   public void setNamingContext(Context namingContext)
+   {
+	this.namingContext = namingContext;
+   }
+
+}




More information about the jboss-cvs-commits mailing list