[jboss-cvs] JBossAS SVN: r86516 - in projects/embedded/trunk: .settings and 15 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 31 05:33:33 EDT 2009


Author: ALRubinger
Date: 2009-03-31 05:33:33 -0400 (Tue, 31 Mar 2009)
New Revision: 86516

Added:
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/BasicServerConfiguration.java
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/JBossEmbeddedAS.java
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/SecurityActions.java
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/spi/
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/spi/JBossServer.java
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/spi/JBossServerConfig.java
Removed:
   projects/embedded/trunk/assembly/src/main/resources/
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/classloading/
   projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/JBossEmbeddedAS.java
   projects/embedded/trunk/testsuite/src/main/resources/
   projects/embedded/trunk/testsuite/src/test/resources/server/
Modified:
   projects/embedded/trunk/.classpath
   projects/embedded/trunk/.settings/org.maven.ide.eclipse.prefs
   projects/embedded/trunk/assembly/.classpath
   projects/embedded/trunk/assembly/.settings/org.maven.ide.eclipse.prefs
   projects/embedded/trunk/assembly/embedded-assembly.xml
   projects/embedded/trunk/assembly/pom.xml
   projects/embedded/trunk/build/.classpath
   projects/embedded/trunk/build/.settings/org.maven.ide.eclipse.prefs
   projects/embedded/trunk/build/pom.xml
   projects/embedded/trunk/core/.classpath
   projects/embedded/trunk/core/.settings/org.maven.ide.eclipse.prefs
   projects/embedded/trunk/core/pom.xml
   projects/embedded/trunk/testsuite/.classpath
   projects/embedded/trunk/testsuite/.settings/org.eclipse.jdt.core.prefs
   projects/embedded/trunk/testsuite/.settings/org.maven.ide.eclipse.prefs
   projects/embedded/trunk/testsuite/pom.xml
   projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/test/server/ServerUnitTestCase.java
Log:
[EMB-22] Create prototype of Embedded using external AS installation

Modified: projects/embedded/trunk/.classpath
===================================================================
--- projects/embedded/trunk/.classpath	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/.classpath	2009-03-31 09:33:33 UTC (rev 86516)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
-	<classpathentry kind="output" path="target-eclipse/classes"/>
+	<classpathentry kind="output" path="target/classes"/>
 </classpath>

Modified: projects/embedded/trunk/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/embedded/trunk/.settings/org.maven.ide.eclipse.prefs	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/.settings/org.maven.ide.eclipse.prefs	2009-03-31 09:33:33 UTC (rev 86516)
@@ -1,7 +1,8 @@
-#Tue Nov 18 02:50:19 GMT-05:00 2008
+#Fri Jan 30 03:12:39 GMT-05:00 2009
 activeProfiles=
 eclipse.preferences.version=1
 filterResources=false
+fullBuildGoals=process-test-resources
 includeModules=false
 resolveWorkspaceProjects=true
 resourceFilterGoals=process-resources resources\:testResources

Modified: projects/embedded/trunk/assembly/.classpath
===================================================================
--- projects/embedded/trunk/assembly/.classpath	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/assembly/.classpath	2009-03-31 09:33:33 UTC (rev 86516)
@@ -1,6 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
-  <classpathentry kind="output" path="target/classes"/>
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-  <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
-</classpath>
\ No newline at end of file
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Modified: projects/embedded/trunk/assembly/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/embedded/trunk/assembly/.settings/org.maven.ide.eclipse.prefs	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/assembly/.settings/org.maven.ide.eclipse.prefs	2009-03-31 09:33:33 UTC (rev 86516)
@@ -1,7 +1,8 @@
-#Wed Nov 05 03:34:42 GMT-05:00 2008
+#Fri Jan 30 03:12:39 GMT-05:00 2009
 activeProfiles=
 eclipse.preferences.version=1
 filterResources=false
+fullBuildGoals=process-test-resources
 includeModules=false
 resolveWorkspaceProjects=true
 resourceFilterGoals=process-resources resources\:testResources

Modified: projects/embedded/trunk/assembly/embedded-assembly.xml
===================================================================
--- projects/embedded/trunk/assembly/embedded-assembly.xml	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/assembly/embedded-assembly.xml	2009-03-31 09:33:33 UTC (rev 86516)
@@ -1,9 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
+  <!--
   vi:ts=2:sw=2:expandtab:
 -->
-<assembly xmlns="http://maven.apache.org/POM/4.0.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<assembly xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.0.0.xsd">
   <id>embedded</id>
   <formats>
@@ -12,11 +11,26 @@
   <includeBaseDirectory>false</includeBaseDirectory>
   <dependencySets>
     <dependencySet>
-      <outputDirectory></outputDirectory>
-      <outputFileNameMapping></outputFileNameMapping>
       <unpack>true</unpack>
-      <scope>runtime</scope>
+      <unpackOptions>
+        <includes>
+          <include>org/jboss/bootstrap/NoAnnotationURLClassLoader.class</include>
+          <include>org/jboss/bootstrap/ServerLoader.class</include>
+          <include>org/jboss/bootstrap/spi/Server.class</include>
+          <include>org/jboss/bootstrap/spi/ServerConfig.class</include>
+          <include>org/jboss/bootstrap/spi/util/ServerConfigUtil.class</include>
+        </includes>
+      </unpackOptions>
+      <includes>
+        <include>org.jboss.bootstrap:jboss-bootstrap</include>
+      </includes>
     </dependencySet>
+    <dependencySet>
+      <unpack>true</unpack>
+      <includes>
+        <include>org.jboss.embedded:jboss-embedded-core</include>
+      </includes>
+    </dependencySet>
   </dependencySets>
   <fileSets>
     <fileSet>

Modified: projects/embedded/trunk/assembly/pom.xml
===================================================================
--- projects/embedded/trunk/assembly/pom.xml	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/assembly/pom.xml	2009-03-31 09:33:33 UTC (rev 86516)
@@ -19,12 +19,16 @@
 
   <!-- Artifact Configuration -->
   <artifactId>jboss-embedded-assembly</artifactId>
+  <packaging>pom</packaging>
   <name>JBossAS Embedded Assembly</name>
   <description>JBoss Application Server Embedded Distribution</description>
 
 
   <!-- Properties -->
   <properties>
+  
+    <!-- Versioning -->
+    <version.org.jboss.embedded_jboss.embedded.core>0.1.0-SNAPSHOT</version.org.jboss.embedded_jboss.embedded.core>
 
   </properties>
 
@@ -32,7 +36,7 @@
   <build>
   
     <plugins>
-      <!-- Assembly Plugin -->
+      <!-- Assembly Plugin --> 
       <plugin>
         <artifactId>maven-assembly-plugin</artifactId>
         <executions>
@@ -58,26 +62,31 @@
   <!-- Dependencies -->
   <dependencies>
     
+    
+    <!--
+    
+    Note: jboss-bootstrap may NOT be leaked as a dependency
+    anywhere in this chain.  This will muss up the ClassLoading
+    needed to run in Embedded mode (as server will be created
+    using wrong ClassLoader)
+    
+     -->
+    
     <dependency>
       <groupId>org.jboss.bootstrap</groupId>
       <artifactId>jboss-bootstrap</artifactId>
-    </dependency>
-    
+      <optional>true</optional>
+    </dependency> 
+
     <dependency>
       <groupId>org.jboss.embedded</groupId>
       <artifactId>jboss-embedded-core</artifactId>
-      <version>0.1.0-SNAPSHOT</version>
-    </dependency>
-
-    <!-- Bring in JBossAS Dependencies Transitively via Build -->
-    <dependency>
-      <groupId>org.jboss.jbossas</groupId>
-      <artifactId>jboss-as-build</artifactId>
-      <type>pom</type>
+      <version>${version.org.jboss.embedded_jboss.embedded.core}</version>
+      <!-- We cannot export the jboss-bootstrap dependency -->
       <exclusions>
         <exclusion>
-          <groupId>org.jboss.jbossas</groupId>
-          <artifactId>jboss-as-bootstrap</artifactId>
+            <groupId>org.jboss.bootstrap</groupId>
+            <artifactId>jboss-bootstrap</artifactId>
         </exclusion>
       </exclusions>
     </dependency>

Modified: projects/embedded/trunk/build/.classpath
===================================================================
--- projects/embedded/trunk/build/.classpath	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/build/.classpath	2009-03-31 09:33:33 UTC (rev 86516)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
-	<classpathentry kind="output" path="target-eclipse/classes"/>
+	<classpathentry kind="output" path="target/classes"/>
 </classpath>

Modified: projects/embedded/trunk/build/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/embedded/trunk/build/.settings/org.maven.ide.eclipse.prefs	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/build/.settings/org.maven.ide.eclipse.prefs	2009-03-31 09:33:33 UTC (rev 86516)
@@ -1,7 +1,8 @@
-#Tue Nov 18 02:50:23 GMT-05:00 2008
+#Fri Jan 30 03:12:39 GMT-05:00 2009
 activeProfiles=
 eclipse.preferences.version=1
 filterResources=false
+fullBuildGoals=process-test-resources
 includeModules=false
 resolveWorkspaceProjects=true
 resourceFilterGoals=process-resources resources\:testResources

Modified: projects/embedded/trunk/build/pom.xml
===================================================================
--- projects/embedded/trunk/build/pom.xml	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/build/pom.xml	2009-03-31 09:33:33 UTC (rev 86516)
@@ -28,8 +28,9 @@
   <properties>
   
     <!-- Versioning -->
-    <version.org.jboss.jbossas>5.0.0-SNAPSHOT</version.org.jboss.jbossas>
-    <version.org.jboss.bootstrap_jboss.bootstrap>0.1.0-SNAPSHOT</version.org.jboss.bootstrap_jboss.bootstrap>
+    <version.org.jboss.bootstrap_jboss.bootstrap>1.0.0-SNAPSHOT</version.org.jboss.bootstrap_jboss.bootstrap>
+    <version.org.jboss.logging_jboss.logging.log4j>2.0.6.GA</version.org.jboss.logging_jboss.logging.log4j>
+    <version.org.jboss.logging_jboss.logging.spi>2.0.5.GA</version.org.jboss.logging_jboss.logging.spi>
     <version.junit_junit>4.5</version.junit_junit>  
   
   </properties>
@@ -73,6 +74,7 @@
           <compilerVersion>1.5</compilerVersion>
           <fork>true</fork>
           <argLine>-Xmx512M</argLine>
+          <executable>${JAVA_HOME}/bin/javac</executable>
         </configuration>
       </plugin>
       
@@ -88,7 +90,6 @@
             <include>**/*TestSuite.java</include>
           </includes>
           <forkMode>always</forkMode>
-          <argLine>-ea -Xmx1024M -Djboss.vfs.cache=org.jboss.virtual.plugins.cache.TimedVFSCache -Djboss.vfs.forceCopy=true</argLine>
         </configuration>
       </plugin>
 
@@ -108,33 +109,32 @@
   <!-- Dependency Management -->
   <dependencyManagement>
     <dependencies>
-  
+
       <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>${version.junit_junit}</version>
+        <scope>test</scope>
       </dependency>
-      
+
       <dependency>
         <groupId>org.jboss.bootstrap</groupId>
         <artifactId>jboss-bootstrap</artifactId>
         <version>${version.org.jboss.bootstrap_jboss.bootstrap}</version>
       </dependency>
-  
-      <!-- Bring in JBossAS Dependencies Transitively via Build -->
+
       <dependency>
-        <groupId>org.jboss.jbossas</groupId>
-        <artifactId>jboss-as-build</artifactId>
-        <version>${version.org.jboss.jbossas}</version>
-        <type>pom</type>
-        <exclusions>
-          <exclusion>
-            <groupId>org.jboss.jbossas</groupId>
-            <artifactId>jboss-as-bootstrap</artifactId>
-          </exclusion>
-        </exclusions>
+        <groupId>org.jboss.logging</groupId>
+        <artifactId>jboss-logging-log4j</artifactId>
+        <version>${version.org.jboss.logging_jboss.logging.log4j}</version>
       </dependency>
-  
+
+      <dependency>
+        <groupId>org.jboss.logging</groupId>
+        <artifactId>jboss-logging-spi</artifactId>
+        <version>${version.org.jboss.logging_jboss.logging.spi}</version>
+      </dependency>
+
     </dependencies>
   </dependencyManagement>
 

Modified: projects/embedded/trunk/core/.classpath
===================================================================
--- projects/embedded/trunk/core/.classpath	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/core/.classpath	2009-03-31 09:33:33 UTC (rev 86516)
@@ -1,9 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-  <classpathentry kind="src" path="src/main/java"/>
-  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
-  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
-  <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
-  <classpathentry kind="output" path="target/classes"/>
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-  <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
-</classpath>
\ No newline at end of file
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Modified: projects/embedded/trunk/core/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/embedded/trunk/core/.settings/org.maven.ide.eclipse.prefs	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/core/.settings/org.maven.ide.eclipse.prefs	2009-03-31 09:33:33 UTC (rev 86516)
@@ -1,7 +1,8 @@
-#Wed Nov 05 03:34:42 GMT-05:00 2008
+#Thu Jan 29 14:27:03 GMT-05:00 2009
 activeProfiles=
 eclipse.preferences.version=1
 filterResources=false
+fullBuildGoals=process-test-resources
 includeModules=false
 resolveWorkspaceProjects=true
 resourceFilterGoals=process-resources resources\:testResources

Modified: projects/embedded/trunk/core/pom.xml
===================================================================
--- projects/embedded/trunk/core/pom.xml	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/core/pom.xml	2009-03-31 09:33:33 UTC (rev 86516)
@@ -1,11 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
+  <!--
   vi:ts=2:sw=2:expandtab:
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    
+
   <!-- Parent -->
   <parent>
     <groupId>org.jboss.embedded</groupId>
@@ -41,25 +40,12 @@
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
     </dependency>
-    
+
     <dependency>
       <groupId>org.jboss.bootstrap</groupId>
       <artifactId>jboss-bootstrap</artifactId>
     </dependency>
 
-    <!-- Bring in JBossAS Dependencies Transitively via Build -->
-    <dependency>
-      <groupId>org.jboss.jbossas</groupId>
-      <artifactId>jboss-as-build</artifactId>
-      <type>pom</type>
-      <exclusions>
-        <exclusion>
-          <groupId>org.jboss.jbossas</groupId>
-          <artifactId>jboss-as-bootstrap</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
   </dependencies>
 
 </project>

Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/BasicServerConfiguration.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/BasicServerConfiguration.java	                        (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/BasicServerConfiguration.java	2009-03-31 09:33:33 UTC (rev 86516)
@@ -0,0 +1,281 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.embedded.server;
+
+import java.io.File;
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.Properties;
+
+import org.jboss.embedded.spi.JBossServerConfig;
+
+/**
+ * BasicServerConfiguration
+ * 
+ * Basic, object-backed view of a server configuration
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class BasicServerConfiguration implements JBossServerConfig
+{
+
+   //-------------------------------------------------------------------------------||
+   // Instance Members -------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   private String bindAddress;
+
+   private String jbossHome;
+
+   private String serverName;
+
+   private final Properties properties = new Properties();
+
+   //-------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /* (non-Javadoc)
+    * @see org.jboss.embedded.spi.JBossServerConfig#getBindAddress()
+    */
+   public String getBindAddress()
+   {
+      String bindAddress = this.bindAddress;
+      if (bindAddress == null)
+      {
+         bindAddress = DEFAULT_BIND_ADDRESS;
+      }
+      return bindAddress;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.embedded.spi.JBossServerConfig#getJBossHome()
+    */
+   public String getJBossHome() throws IllegalStateException
+   {
+      // Obtain from explicitly-specified
+      String jbossHome = this.jbossHome;
+      if (jbossHome != null && jbossHome.length() > 0)
+      {
+         return jbossHome;
+      }
+
+      // Obtain from system property
+      String jbossHomeSysProp = System.getProperty(SYS_PROP_JBOSS_HOME);
+      if (jbossHomeSysProp != null && jbossHomeSysProp.length() > 0)
+      {
+         return jbossHomeSysProp;
+      }
+
+      // Obtain from env var
+      String jbossHomeEnvVar = System.getenv(ENV_VAR_JBOSS_HOME);
+      if (jbossHomeEnvVar != null && jbossHomeEnvVar.length() > 0)
+      {
+         return jbossHomeEnvVar;
+      }
+
+      // Shouldn't be reached
+      throw new IllegalStateException("JBoss Home must be specified either explicitly or via environment variable "
+            + ENV_VAR_JBOSS_HOME + " or system property " + SYS_PROP_JBOSS_HOME);
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.embedded.spi.JBossServerConfig#getServerName()
+    */
+   public String getServerName()
+   {
+      // Obtain specified
+      String serverName = this.serverName;
+
+      // If not present, default
+      if (serverName == null || serverName.length() == 0)
+      {
+         serverName = DEFAULT_SERVER_NAME;
+      }
+
+      // Return
+      return serverName;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.embedded.spi.JBossServerConfig#setBindAddress(java.lang.String)
+    */
+   public JBossServerConfig setBindAddress(String bindAddress) throws IllegalArgumentException
+   {
+      // Ensure specified
+      if (bindAddress == null || bindAddress.length() == 0)
+      {
+         throw new IllegalArgumentException("Bind Address must be specified");
+      }
+
+      // Validate
+      InetAddress address = null;
+      try
+      {
+         address = InetAddress.getByName(bindAddress);
+      }
+      catch (UnknownHostException e)
+      {
+         throw new IllegalArgumentException("Supplied hostname is not valid for bind address", e);
+      }
+
+      // Set
+      return this.setBindAddress(address);
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.embedded.spi.JBossServerConfig#setBindAddress(java.net.InetAddress)
+    */
+   public JBossServerConfig setBindAddress(InetAddress bindAddress) throws IllegalArgumentException
+   {
+      // Ensure specified
+      if (bindAddress == null)
+      {
+         throw new IllegalArgumentException("Bind Address must be specified");
+      }
+
+      // Set
+      this.bindAddress = bindAddress.getHostAddress();
+
+      // Return
+      return this;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.embedded.spi.JBossServerConfig#setJBossHome(java.lang.String)
+    */
+   public JBossServerConfig setJBossHome(String jbossHome) throws IllegalArgumentException
+   {
+      // Ensure specified
+      if (jbossHome == null || jbossHome.length() == 0)
+      {
+         throw new IllegalArgumentException("JBoss Home must be specified");
+      }
+
+      // Initialize
+      URL jbossHomeURL = null;
+
+      // See if we've been given a URL
+      try
+      {
+         jbossHomeURL = new URL(jbossHome);
+         return this.setJBossHome(jbossHomeURL);
+      }
+      catch (MalformedURLException e1)
+      {
+         // Swallow, that's OK, we'll see if it's filesystem
+      }
+
+      // Make the JBOSS_HOME file for validation purposes
+      File jbossHomeFile = new File(jbossHome);
+      if (!jbossHomeFile.exists())
+      {
+         throw new IllegalArgumentException("Specified JBoss Home does not exist: " + jbossHomeFile.getAbsolutePath());
+      }
+      if (!jbossHomeFile.isDirectory())
+      {
+         throw new IllegalArgumentException("Specified JBoss Home must be a directory: "
+               + jbossHomeFile.getAbsolutePath());
+      }
+
+      // Set
+      try
+      {
+         jbossHomeURL = jbossHomeFile.toURL();
+      }
+      catch (MalformedURLException e)
+      {
+         throw new RuntimeException("JBoss Home could not be represented as a URL", e);
+      }
+      return this.setJBossHome(jbossHomeURL);
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.embedded.spi.JBossServerConfig#setJBossHome(java.net.URL)
+    */
+   public JBossServerConfig setJBossHome(URL jbossHome) throws IllegalArgumentException
+   {
+      // Ensure specified
+      if (jbossHome == null)
+      {
+         throw new IllegalArgumentException("JBoss Home must be specified");
+      }
+
+      // Set 
+      this.jbossHome = jbossHome.toExternalForm();
+
+      // Return
+      return this;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.embedded.spi.JBossServerConfig#setServerName(java.lang.String)
+    */
+   public JBossServerConfig setServerName(String serverName) throws IllegalArgumentException
+   {
+      // Ensure specified
+      if (serverName == null || serverName.length() == 0)
+      {
+         throw new IllegalStateException("Server name must be specified");
+      }
+
+      // Set
+      this.serverName = serverName;
+
+      // Return
+      return this;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.embedded.spi.JBossServerConfig#getProperties()
+    */
+   public Properties getProperties()
+   {
+      // Return a copy, our properties are immutable and cannot be exported
+      Properties props = new Properties();
+      props.putAll(this.properties);
+      return props;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.embedded.spi.JBossServerConfig#setProperty(java.lang.String, java.lang.String)
+    */
+   public JBossServerConfig setProperty(String property, String value) throws IllegalArgumentException
+   {
+      // Ensure specified property
+      if (property == null || property.length() == 0)
+      {
+         throw new IllegalArgumentException("Property key must be specified");
+      }
+
+      // Set
+      this.properties.put(property, value);
+
+      // Return
+      return this;
+   }
+
+}

Deleted: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/JBossEmbeddedAS.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/JBossEmbeddedAS.java	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/JBossEmbeddedAS.java	2009-03-31 09:33:33 UTC (rev 86516)
@@ -1,142 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
-  *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.embedded.server;
-
-import java.net.URL;
-import java.util.Properties;
-
-import org.jboss.bootstrap.spi.Server;
-import org.jboss.bootstrap.spi.ServerConfig;
-import org.jboss.logging.Logger;
-import org.jboss.system.server.ServerLoader;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * JBossEmbeddedAS
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public class JBossEmbeddedAS
-{
-
-   //------------------------------------------------------------------||
-   // Class Members ---------------------------------------------------||
-   //------------------------------------------------------------------||
-
-   private static final Logger log = Logger.getLogger(JBossEmbeddedAS.class);
-
-   //------------------------------------------------------------------||
-   // Constructor -----------------------------------------------------||
-   //------------------------------------------------------------------||
-
-   /**
-    * Sole Constructor, no-args
-    */
-   public JBossEmbeddedAS()
-   {
-
-      /*
-       * This section serves as a prototype only.
-       * 
-       * It is bound to be ugly for the time being. :)
-       */
-
-      // Initialize a server
-      Server server = null;
-
-      try
-      {
-
-         // Initialize new Properties from System props
-         Properties props = new Properties(System.getProperties());
-
-         // When running from the filesystem this is MUCH faster
-         //String jbossHome = new File("/home/alrubinger/Desktop/embedded").toURL().toString();
-
-         // Grab the JAR/filesystem root we're contained in, hopefully the EmbeddedAS Distribution 
-         URL jarUrl = JBossEmbeddedAS.class.getProtectionDomain().getCodeSource().getLocation();
-
-         // Construct VFS representation
-         VirtualFile jarVirtualFile = VFS.getRoot(jarUrl);
-         VirtualFile jbossHome = jarVirtualFile.getChild("embedded");
-
-         log.info(jbossHome);
-         String jbossHomeString = jbossHome.toURL().toString();
-
-         log.info(jbossHomeString);
-
-         props.setProperty(ServerConfig.HOME_URL, jbossHomeString);
-         props.setProperty(ServerConfig.HOME_DIR, jbossHomeString);
-
-         //      props.setProperty(ServerConfig.SERVER_BASE_URL,serverConfigUrl);
-         //      props.setProperty(ServerConfig.SERVER_BASE_DIR,serverConfigUrl);
-
-         /*
-          * Set config home
-          */
-
-         VirtualFile configFile = jbossHome.getChild("conf");
-         String configFileUrl = configFile.toURL().toString();
-         props.setProperty(ServerConfig.SERVER_CONFIG_URL, configFileUrl);
-
-         /*
-          * Set the bind address
-          */
-
-         String bindAddress = "127.0.0.1";
-         props.setProperty(ServerConfig.SERVER_BIND_ADDRESS, bindAddress);
-         System.setProperty(ServerConfig.SERVER_BIND_ADDRESS, bindAddress);
-
-         /*
-          * Make the server from the properties
-          */
-
-         // Get a loader
-         ServerLoader loader = null;
-         loader = new ServerLoader(props);
-
-         // Load a Server
-         server = loader.load(Thread.currentThread().getContextClassLoader());
-
-         // Init and Start
-         server.init(props);
-         server.start();
-      }
-      catch (Exception t)
-      {
-         try
-         {
-            server.shutdown();
-         }
-         catch (Exception e)
-         {
-            // Swallow
-         }
-
-         // TODO Auto-generated catch block
-         throw new RuntimeException(t);
-      }
-   }
-
-}

Copied: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/JBossEmbeddedAS.java (from rev 86398, projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/JBossEmbeddedAS.java)
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/JBossEmbeddedAS.java	                        (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/JBossEmbeddedAS.java	2009-03-31 09:33:33 UTC (rev 86516)
@@ -0,0 +1,271 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.embedded.server;
+
+import java.io.File;
+import java.util.Properties;
+import java.util.concurrent.Future;
+
+import org.jboss.bootstrap.ServerLoader;
+import org.jboss.bootstrap.spi.Server;
+import org.jboss.bootstrap.spi.ServerConfig;
+import org.jboss.embedded.spi.JBossServer;
+import org.jboss.embedded.spi.JBossServerConfig;
+import org.jboss.logging.Logger;
+
+/**
+ * JBossEmbeddedAS
+ * 
+ * Implementation of a simplified view of the JBoss 
+ * Application Server as exposed to in-JVM clients
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class JBossEmbeddedAS implements JBossServer
+{
+   //-------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   private static final Logger log = Logger.getLogger(JBossEmbeddedAS.class);
+
+   private static String concurrentLib = "concurrent.jar";
+
+   @Deprecated
+   private static final String ERROR_MESSAGE_NOT_SUPPORTED = "Currently under development";
+
+   //-------------------------------------------------------------------------------||
+   // Instance Members -------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Underlying Server instance.  Synchronization on "this"
+    */
+   private Server server;
+
+   /**
+    * Configuration for the Server
+    */
+   private JBossServerConfig config;
+
+   //-------------------------------------------------------------------------------||
+   // Factory Methods --------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Creates and returns a new Server instance based upon the specified configuration
+    * 
+    * @param config The configuration for this server
+    * @throws IllegalArgumentException If no configuation was specified
+    */
+   public static final JBossServer create(final JBossServerConfig config) throws IllegalArgumentException
+   {
+      // Ensure the user's given us a config
+      if (config == null)
+      {
+         throw new IllegalArgumentException("Configuration for the server is a required argument");
+      }
+
+      // Create
+      JBossServer server = new JBossEmbeddedAS(config);
+
+      // Return
+      return server;
+   }
+
+   //-------------------------------------------------------------------------------||
+   // Internal Constructor ---------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Constructs a new Embedded instance with default configuration
+    */
+   private JBossEmbeddedAS(final JBossServerConfig config)
+   {
+      // Precondition check
+      assert config != null : "Configuration is required";
+
+      // Set the Configuration
+      this.config = config;
+   }
+
+   //-------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * {@link JBossServer#initialize()}
+    */
+   public void initialize() throws IllegalStateException, Throwable
+   {
+      // Get the Server and Config
+      Server server = this.server;
+      JBossServerConfig config = this.config;
+
+      // Precondition check
+      assert config != null : "Configuration should not be null";
+
+      // Ensure not already initialized
+      if (server != null)
+      {
+         throw new IllegalStateException("Already initialized: " + this);
+      }
+
+      // Get the default properties from the System
+      Properties props = System.getProperties();
+
+      // Set JBOSS_HOME
+      String configuredJBossHome = config.getJBossHome();
+      File jbossHomeFile = new File(configuredJBossHome);
+      String jbossHomeUrl = jbossHomeFile.toURL().toExternalForm();
+      props.setProperty(ServerConfig.HOME_URL, jbossHomeUrl);
+      props.setProperty(ServerConfig.HOME_DIR, jbossHomeFile.getAbsolutePath());
+
+      // Set Bind Address
+      String bindAddress = config.getBindAddress();
+      props.setProperty(ServerConfig.SERVER_BIND_ADDRESS, bindAddress);
+
+      // Set Server Name
+      String serverName = config.getServerName();
+      props.setProperty(ServerConfig.SERVER_NAME, serverName);
+
+      //FIXME Doesn't really belong here?
+      // Initialize the JDK logmanager
+      String name = System.getProperty("java.util.logging.manager");
+      if (name == null)
+      {
+         System.setProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager");
+      }
+
+      // Place any other properties defined by configuration
+      props.putAll(config.getProperties());
+
+      /*
+       * Create the ServerLoader
+       */
+      ServerLoader loader = null;
+      try
+      {
+         loader = this.createServerLoader(props);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException("Problem in creating " + ServerLoader.class.getSimpleName(), e);
+      }
+
+      //FIXME Hack stuff required by jboss-bootstrap
+      loader.addEndorsedJars();
+      loader.addLibrary(concurrentLib);
+
+      // Get the Server, initialize, and set
+      ClassLoader tccl = SecurityActions.getTccl();
+      server = loader.load(tccl);
+      server.init(props);
+      this.server = server;
+   }
+
+   /**
+    * {@link JBossServer#start()}
+    */
+   public void start() throws IllegalStateException, Throwable
+   {
+      synchronized (this)
+      {
+         // Get Server
+         Server server = this.server;
+
+         // Ensure Server has been initialized
+         if (server == null)
+         {
+            this.initialize();
+            server = this.server;
+         }
+
+         // Start (blocks)
+         server.start();
+      }
+   }
+
+   /**
+    * {@link JBossServer#startAndWait()}
+    */
+   public Future<Boolean> startAndWait()
+   {
+      throw new UnsupportedOperationException(ERROR_MESSAGE_NOT_SUPPORTED);
+   }
+
+   /**
+    * {@link JBossServer#shutdown()}
+    */
+   public void shutdown()
+   {
+      synchronized (this)
+      {
+         // Get Server
+         Server server = this.server;
+
+         // Ensure Server is Available
+         if (server == null)
+         {
+            throw new IllegalStateException("Server has not yet been initialized");
+         }
+
+         // Start (blocks)
+         server.shutdown();
+      }
+   }
+
+   /**
+    * {@link JBossServer#stopAndWait()}
+    */
+   public Future<Boolean> stopAndWait()
+   {
+      {
+         throw new UnsupportedOperationException(ERROR_MESSAGE_NOT_SUPPORTED);
+      }
+   }
+
+   /**
+    * {@link JBossServer#isStarted()}
+    */
+   public boolean isStarted()
+   {
+      return this.server != null && this.server.isStarted();
+   }
+
+   //-------------------------------------------------------------------------------||
+   // Internal Helper Methods ------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Creates and returns a new ServerLoader
+    */
+   private ServerLoader createServerLoader(Properties props) throws Exception
+   {
+      // Create new Loader from Props 
+      ServerLoader loader = new ServerLoader(props);
+
+      // Return
+      return loader;
+   }
+}


Property changes on: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/JBossEmbeddedAS.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/SecurityActions.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/SecurityActions.java	                        (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/SecurityActions.java	2009-03-31 09:33:33 UTC (rev 86516)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.embedded.server;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * SecurityActions
+ * 
+ * Package-private utility methods for secure operations
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+class SecurityActions
+{
+
+   //-------------------------------------------------------------------------------||
+   // Internal Constructor ---------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Ensure we cannot be extended/leaked
+    */
+   private SecurityActions()
+   {
+      // Non-instanciable
+   }
+
+   //-------------------------------------------------------------------------------||
+   // Utilities --------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Obtains the Thread Context CL
+    * 
+    * @return
+    */
+   static final ClassLoader getTccl()
+   {
+      return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+      {
+
+         public ClassLoader run()
+         {
+            return Thread.currentThread().getContextClassLoader();
+         }
+
+      });
+   }
+}

Copied: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/spi/JBossServer.java (from rev 86398, projects/embedded/trunk/core/src/main/java/org/jboss/embedded/server/JBossEmbeddedAS.java)
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/spi/JBossServer.java	                        (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/spi/JBossServer.java	2009-03-31 09:33:33 UTC (rev 86516)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.embedded.spi;
+
+import java.util.concurrent.Future;
+
+/**
+ * JBossServer
+ * 
+ * Simplified view of the JBoss Server as
+ * exposed to in-JVM clients
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface JBossServer
+{
+   //-------------------------------------------------------------------------------||
+   // Contracts --------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Locks down the configuration used, creates the necessary
+    * backing objects, and makes the Server available for start
+    * 
+    * @throws IllegalStateException If already initialized
+    * @throws Throwable If some error was present in configuration
+    */
+   void initialize() throws IllegalStateException, Throwable;
+
+   /**
+    * Starts the server; blocking operation.
+    * 
+    * Will optionally invoke upon {@link JBossServer#initialize()}
+    * if this has not yet been explicitly called
+    * 
+    * @throws IllegalStateException If already started
+    * @throws Throwable Some error occured in starting the server
+    */
+   void start() throws IllegalStateException, Throwable;
+
+   /**
+    * Starts the server in the background, returning a reference to 
+    * determine when all is ready
+    * 
+    * @return Whether or not the server started successfully
+    */
+   Future<Boolean> startAndWait();
+
+   /**
+    * Stops the server; blocking operation
+    */
+   void shutdown();
+
+   /**
+    * Requests that the server shut down in the background, 
+    * returning a reference to signal when completed 
+    *  
+    * @return
+    */
+   Future<Boolean> stopAndWait();
+
+   /**
+    * Signals whether the server is currently running
+    * 
+    * @return
+    */
+   boolean isStarted();
+
+}


Property changes on: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/spi/JBossServer.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/spi/JBossServerConfig.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/spi/JBossServerConfig.java	                        (rev 0)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/spi/JBossServerConfig.java	2009-03-31 09:33:33 UTC (rev 86516)
@@ -0,0 +1,153 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.embedded.spi;
+
+import java.net.InetAddress;
+import java.net.URL;
+import java.util.Properties;
+
+/**
+ * JBossEmbeddedConfig
+ *
+ * User configuration for the Embedded Application Server.
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface JBossServerConfig
+{
+   //-------------------------------------------------------------------------------||
+   // Constants --------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   String DEFAULT_BIND_ADDRESS = "127.0.0.1";
+
+   String DEFAULT_SERVER_NAME = "default";
+
+   String ENV_VAR_JBOSS_HOME = "JBOSS_HOME";
+
+   String SYS_PROP_JBOSS_HOME = "jboss.home";
+
+   //-------------------------------------------------------------------------------||
+   // Contracts --------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Obtains the bind address to be used for the Server.  If none has been 
+    * explicitly specified, this will default to the local loopback
+    * (ie. 127.0.0.1)
+    * 
+    * @return
+    */
+   String getBindAddress();
+
+   /**
+    * Sets the bind address for the server
+    * 
+    * @param bindAddress
+    * @return
+    * @throws IllegalArgumentException If the specified bind address cannot be resolved
+    * to a known host via {@link InetAddress#getAllByName(String)}, or if not specified
+    */
+   JBossServerConfig setBindAddress(String bindAddress) throws IllegalArgumentException;
+
+   /**
+    * Obtains the name of the server configuration.  If not explicitly-specified,
+    * this will default to "default"
+    *  
+    * @return
+    */
+   String getServerName();
+
+   /**
+    * Sets the name of the server configuration 
+    * 
+    * @param serverName
+    * @return
+    * @throws IllegalArgumentException If not specified
+    */
+   JBossServerConfig setServerName(String serverName) throws IllegalArgumentException;
+
+   /**
+    * Obtains the $JBOSS_HOME.  If none has been explicitly set, 
+    * the following actions will take place:
+    * 
+    * 1) Set from environment variable "JBOSS_HOME" if present
+    * 2) Set from system property "jboss.home" (overrides environment variable)
+    *    if present
+    * 3) Throw IllegalStateException 
+    * 
+    * @return
+    * @throws IllegalStateException If no JBOSS_HOME has been explicitly provided
+    * or could be found in environment variables or system properties
+    */
+   String getJBossHome() throws IllegalStateException;
+
+   /**
+    * Sets $JBOSS_HOME to be used for the server
+    * 
+    * @param jbossHome The absolute filesystem path to $JBOSS_HOME
+    * @return This configuration
+    * @throws IllegalArgumentException If $JBOSS_HOME is not a valid 
+    * and existent path
+    */
+   JBossServerConfig setJBossHome(String jbossHome) throws IllegalArgumentException;
+
+   /**
+    * Sets $JBOSS_HOME to be used for the server
+    * 
+    * @param jbossHome The URL to $JBOSS_HOME
+    * @return This configuration
+    * @throws IllegalArgumentException If $JBOSS_HOME is not a valid 
+    * and existent path
+    */
+   JBossServerConfig setJBossHome(URL jbossHome) throws IllegalArgumentException;
+
+   /**
+    * Sets the bind address for the server
+    * 
+    * @param bindAddress
+    * @return
+    * @throws IllegalArgumentException If not specified
+    */
+   JBossServerConfig setBindAddress(InetAddress bindAddress) throws IllegalArgumentException;
+
+   /**
+    * Sets the specified value upon the specified property
+    * 
+    * @param property
+    * @param value
+    * @return
+    * @throws IllegalArgumentException If the property is null
+    */
+   JBossServerConfig setProperty(String property, String value) throws IllegalArgumentException;
+
+   /**
+    * Returns all properties backed by this configuration.  Useful for export 
+    * Finto jboss-bootstrap.  
+    * 
+    * @return
+    */
+   Properties getProperties();
+
+}

Modified: projects/embedded/trunk/testsuite/.classpath
===================================================================
--- projects/embedded/trunk/testsuite/.classpath	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/testsuite/.classpath	2009-03-31 09:33:33 UTC (rev 86516)
@@ -1,8 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
-  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
-  <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
-  <classpathentry kind="output" path="target/classes"/>
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-  <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
-</classpath>
\ No newline at end of file
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Modified: projects/embedded/trunk/testsuite/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/embedded/trunk/testsuite/.settings/org.eclipse.jdt.core.prefs	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/testsuite/.settings/org.eclipse.jdt.core.prefs	2009-03-31 09:33:33 UTC (rev 86516)
@@ -1,4 +1,4 @@
-#Thu Nov 20 02:59:01 GMT-05:00 2008
+#Sat Mar 28 16:43:39 GMT-05:00 2009
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.source=1.5

Modified: projects/embedded/trunk/testsuite/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/embedded/trunk/testsuite/.settings/org.maven.ide.eclipse.prefs	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/testsuite/.settings/org.maven.ide.eclipse.prefs	2009-03-31 09:33:33 UTC (rev 86516)
@@ -1,7 +1,8 @@
-#Wed Nov 05 03:34:42 GMT-05:00 2008
+#Fri Jan 30 03:12:39 GMT-05:00 2009
 activeProfiles=
 eclipse.preferences.version=1
 filterResources=false
+fullBuildGoals=process-test-resources
 includeModules=false
 resolveWorkspaceProjects=true
 resourceFilterGoals=process-resources resources\:testResources

Modified: projects/embedded/trunk/testsuite/pom.xml
===================================================================
--- projects/embedded/trunk/testsuite/pom.xml	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/testsuite/pom.xml	2009-03-31 09:33:33 UTC (rev 86516)
@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    
+
   <!-- Parent -->
   <parent>
     <groupId>org.jboss.embedded</groupId>
@@ -24,6 +23,9 @@
   <!-- Properties -->
   <properties>
 
+    <!-- Versioning -->
+    <version.org.jboss.embedded_jboss.embedded.assembly>0.1.0-SNAPSHOT</version.org.jboss.embedded_jboss.embedded.assembly>
+
   </properties>
 
   <!-- Build -->
@@ -34,14 +36,38 @@
   <!-- Dependencies -->
   <dependencies>
 
+    <!--
+      Bring in Embedded distribution
+    -->
     <dependency>
       <groupId>org.jboss.embedded</groupId>
       <artifactId>jboss-embedded-assembly</artifactId>
-      <version>0.1.0-SNAPSHOT</version>
+      <version>${version.org.jboss.embedded_jboss.embedded.assembly}</version>
+      <optional>true</optional>
       <classifier>embedded</classifier>
-      <scope>provided</scope>
     </dependency>
+
+    <!-- 
     
+    
+    
+     -->
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-spi</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
   </dependencies>
 
 </project>

Modified: projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/test/server/ServerUnitTestCase.java
===================================================================
--- projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/test/server/ServerUnitTestCase.java	2009-03-31 08:49:39 UTC (rev 86515)
+++ projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/test/server/ServerUnitTestCase.java	2009-03-31 09:33:33 UTC (rev 86516)
@@ -21,11 +21,21 @@
  */
 package org.jboss.embedded.test.server;
 
+import junit.framework.TestCase;
+
+import org.jboss.embedded.server.BasicServerConfiguration;
 import org.jboss.embedded.server.JBossEmbeddedAS;
+import org.jboss.embedded.spi.JBossServer;
+import org.jboss.embedded.spi.JBossServerConfig;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
  * ServerUnitTestCase
+ * 
+ * Test Cases to ensure that the Embedded Server is working 
+ * as expected
  *
  * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
  * @version $Revision: $
@@ -33,11 +43,60 @@
 public class ServerUnitTestCase
 {
 
+   //-------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * The server instance
+    */
+   private static JBossServer server;
+
+   //-------------------------------------------------------------------------------||
+   // Tests ------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Ensures that the server reports as running
+    */
    @Test
    public void testServerStart() throws Throwable
    {
-      JBossEmbeddedAS as = new JBossEmbeddedAS();
-      
+      boolean isStarted = server.isStarted();
+      TestCase.assertTrue("The server is not reporting as started", isStarted);
    }
-   
+
+   //-------------------------------------------------------------------------------||
+   // Lifecycle --------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Creates a new Configuration, starts the Server
+    * 
+    * @throws Throwable
+    */
+   @BeforeClass
+   public static void startServer() throws Throwable
+   {
+      // Create Server Config
+      JBossServerConfig config = new BasicServerConfiguration();
+
+      // Make Server
+      server = JBossEmbeddedAS.create(config);
+
+      // Start
+      server.start();
+   }
+
+   /**
+    * Stops the server
+    * 
+    * @throws Throwable
+    */
+   @AfterClass
+   public static void stopServer() throws Throwable
+   {
+      server.shutdown();
+   }
+
 }




More information about the jboss-cvs-commits mailing list