[jboss-cvs] JBossAS SVN: r86700 - in projects/reloaded/trunk: main and 26 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Apr 2 17:42:44 EDT 2009


Author: wolfc
Date: 2009-04-02 17:42:44 -0400 (Thu, 02 Apr 2009)
New Revision: 86700

Added:
   projects/reloaded/trunk/main/
   projects/reloaded/trunk/main/.classpath
   projects/reloaded/trunk/main/.project
   projects/reloaded/trunk/main/.settings/
   projects/reloaded/trunk/main/.settings/org.eclipse.jdt.core.prefs
   projects/reloaded/trunk/main/.settings/org.maven.ide.eclipse.prefs
   projects/reloaded/trunk/main/pom.xml
   projects/reloaded/trunk/main/src/
   projects/reloaded/trunk/main/src/main/
   projects/reloaded/trunk/main/src/main/java/
   projects/reloaded/trunk/main/src/main/java/org/
   projects/reloaded/trunk/main/src/main/java/org/jboss/
   projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/
   projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/main/
   projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/main/Main.java
   projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/main/options/
   projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/main/options/Option.java
   projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/main/options/OptionParser.java
   projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/server/
   projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/server/ReloadedServerConfigImpl.java
   projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/server/ReloadedServerImpl.java
   projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/spi/
   projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/spi/ReloadedServer.java
   projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/spi/ReloadedServerConfig.java
   projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/spi/ReloadedServerConfigFactory.java
   projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/util/
   projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/util/DynamicPropertyHandler.java
   projects/reloaded/trunk/main/src/test/
   projects/reloaded/trunk/main/src/test/java/
   projects/reloaded/trunk/main/src/test/java/org/
   projects/reloaded/trunk/main/src/test/java/org/jboss/
   projects/reloaded/trunk/main/src/test/java/org/jboss/reloaded/
   projects/reloaded/trunk/main/src/test/java/org/jboss/reloaded/main/
   projects/reloaded/trunk/main/src/test/java/org/jboss/reloaded/main/test/
   projects/reloaded/trunk/main/src/test/java/org/jboss/reloaded/main/test/main/
   projects/reloaded/trunk/main/src/test/java/org/jboss/reloaded/main/test/main/unit/
   projects/reloaded/trunk/main/src/test/java/org/jboss/reloaded/main/test/main/unit/MainTestCase.java
   projects/reloaded/trunk/main/src/test/resources/
   projects/reloaded/trunk/main/src/test/resources/log4j.xml
   projects/reloaded/trunk/main/src/test/resources/server/
   projects/reloaded/trunk/main/src/test/resources/server/default/
   projects/reloaded/trunk/main/src/test/resources/server/default/conf/
   projects/reloaded/trunk/main/src/test/resources/server/default/conf/bootstrap.xml
   projects/reloaded/trunk/main/src/test/resources/server/default/conf/bootstrap/
   projects/reloaded/trunk/main/src/test/resources/server/default/conf/bootstrap/dummy.xml
   projects/reloaded/trunk/main/src/test/resources/server/default/conf/jboss-service.xml
Log:
RELOADED-6: prototype launcher for Reloaded


Property changes on: projects/reloaded/trunk/main
___________________________________________________________________
Name: svn:ignore
   + eclipse-target
target


Added: projects/reloaded/trunk/main/.classpath
===================================================================
--- projects/reloaded/trunk/main/.classpath	                        (rev 0)
+++ projects/reloaded/trunk/main/.classpath	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,8 @@
+<classpath>
+  <classpathentry kind="src" path="src/main/java"/>
+  <classpathentry kind="src" path="src/test/java" output="eclipse-target/test-classes"/>
+  <classpathentry kind="src" path="src/test/resources" output="eclipse-target/test-classes" excluding="**/*.java"/>
+  <classpathentry kind="output" path="eclipse-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

Added: projects/reloaded/trunk/main/.project
===================================================================
--- projects/reloaded/trunk/main/.project	                        (rev 0)
+++ projects/reloaded/trunk/main/.project	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,17 @@
+<projectDescription>
+  <name>jboss-reloaded-main</name>
+  <comment></comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+    <buildCommand>
+      <name>org.maven.ide.eclipse.maven2Builder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+    <nature>org.maven.ide.eclipse.maven2Nature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Added: projects/reloaded/trunk/main/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/reloaded/trunk/main/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/reloaded/trunk/main/.settings/org.eclipse.jdt.core.prefs	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,5 @@
+#Wed Apr 01 22:39:02 CEST 2009
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5

Added: projects/reloaded/trunk/main/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/reloaded/trunk/main/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ projects/reloaded/trunk/main/.settings/org.maven.ide.eclipse.prefs	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,8 @@
+#Thu Apr 02 15:02:16 CEST 2009
+activeProfiles=eclipse
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=false
+resourceFilterGoals=process-resources resources\:testResources
+version=1

Added: projects/reloaded/trunk/main/pom.xml
===================================================================
--- projects/reloaded/trunk/main/pom.xml	                        (rev 0)
+++ projects/reloaded/trunk/main/pom.xml	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,361 @@
+<!-- 
+  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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.jboss.reloaded</groupId>
+    <artifactId>jboss-reloaded-build</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <relativePath>../build/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>jboss-reloaded-main</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>JBoss Reloaded Main</name>
+  <url>http://www.jboss.org</url>
+  <description>
+  </description>
+  
+  <properties>
+    <version.org.jboss.aop>2.0.1.GA</version.org.jboss.aop>
+    <version.org.jboss.deployers>2.0.5.GA</version.org.jboss.deployers>
+    <version.org.jboss.integration>6.0.0.Alpha7</version.org.jboss.integration>
+    <version.org.jboss.jbossas>6.0.0-SNAPSHOT</version.org.jboss.jbossas>
+    <version.org.jboss.mx>6.0.0-SNAPSHOT</version.org.jboss.mx>
+  </properties>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>copy-dependencies</id>
+            <!-- 
+            <phase>package</phase>
+            -->
+            <goals>
+              <goal>copy-dependencies</goal>
+            </goals>
+            <configuration>
+              <includeScope>runtime</includeScope>
+              <outputDirectory>${project.build.directory}/lib</outputDirectory>
+              <stripVersion>true</stripVersion>
+            </configuration>
+          </execution>
+          <!--
+          <execution>
+            <id>copy</id>
+            <phase>process-resources</phase>
+            <goals>
+              <goal>copy</goal>
+            </goals>
+            <configuration>
+              <artifactItems>
+                <artifactItem>
+                   <groupId>dom4j</groupId>
+                   <artifactId>dom4j</artifactId>
+                   <version>1.6.1</version>
+                </artifactItem>
+                <artifactItem>
+                   <groupId>org.codehaus.woodstox</groupId>
+                   <artifactId>wstx-lgpl</artifactId>
+                   <version>3.2.6</version>
+                   <destFileName>wstx.jar</destFileName>
+                </artifactItem>
+                <artifactItem>
+                   <groupId>org.jboss.aop</groupId>
+                   <artifactId>jboss-aop</artifactId>
+                   <version>${version.org.jboss.aop}</version>
+                </artifactItem>
+                <artifactItem>
+                   <groupId>org.jboss.aop</groupId>
+                   <artifactId>jboss-aop-asintegration-core</artifactId>
+                   <version>${version.org.jboss.aop}</version>
+                </artifactItem>
+                <artifactItem>
+                   <groupId>org.jboss.aop</groupId>
+                   <artifactId>jboss-aop-asintegration-jmx</artifactId>
+                   <version>${version.org.jboss.aop}</version>
+                </artifactItem>
+                <artifactItem>
+                   <groupId>org.jboss.aop</groupId>
+                   <artifactId>jboss-aop-asintegration-mc</artifactId>
+                   <version>${version.org.jboss.aop}</version>
+                </artifactItem>
+                <artifactItem>
+                   <groupId>org.jboss.deployers</groupId>
+                   <artifactId>jboss-deployers-client</artifactId>
+                   <version>${version.org.jboss.deployers}</version>
+                </artifactItem>
+                <artifactItem>
+                   <groupId>org.jboss.deployers</groupId>
+                   <artifactId>jboss-deployers-client-spi</artifactId>
+                   <version>${version.org.jboss.deployers}</version>
+                </artifactItem>
+                <artifactItem>
+                   <groupId>org.jboss.deployers</groupId>
+                   <artifactId>jboss-deployers-core</artifactId>
+                   <version>${version.org.jboss.deployers}</version>
+                </artifactItem>
+                <artifactItem>
+                   <groupId>org.jboss.deployers</groupId>
+                   <artifactId>jboss-deployers-core-spi</artifactId>
+                   <version>${version.org.jboss.deployers}</version>
+                </artifactItem>
+                <artifactItem>
+                   <groupId>org.jboss.deployers</groupId>
+                   <artifactId>jboss-deployers-impl</artifactId>
+                   <version>${version.org.jboss.deployers}</version>
+                </artifactItem>
+                <artifactItem>
+                   <groupId>org.jboss.deployers</groupId>
+                   <artifactId>jboss-deployers-spi</artifactId>
+                   <version>${version.org.jboss.deployers}</version>
+                </artifactItem>
+                <artifactItem>
+                   <groupId>org.jboss.deployers</groupId>
+                   <artifactId>jboss-deployers-structure-spi</artifactId>
+                   <version>${version.org.jboss.deployers}</version>
+                </artifactItem>
+                <artifactItem>
+                   <groupId>org.jboss.deployers</groupId>
+                   <artifactId>jboss-deployers-vfs</artifactId>
+                   <version>${version.org.jboss.deployers}</version>
+                </artifactItem>
+                <artifactItem>
+                   <groupId>org.jboss.deployers</groupId>
+                   <artifactId>jboss-deployers-vfs-spi</artifactId>
+                   <version>${version.org.jboss.deployers}</version>
+                </artifactItem>
+                <artifactItem>
+                   <groupId>org.jboss.integration</groupId>
+                   <artifactId>jboss-profileservice-spi</artifactId>
+                   <version>${version.org.jboss.integration}</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.jboss.jbossas</groupId>
+                  <artifactId>jboss-as-aspects</artifactId>
+                  <version>${version.org.jboss.jbossas}</version>
+                  <classifier>jboss-aop-jboss5</classifier>
+                  <destFileName>jboss-aop-jboss5.jar</destFileName>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.jboss.jbossas</groupId>
+                  <artifactId>jboss-as-system</artifactId>
+                  <version>${version.org.jboss.jbossas}</version>
+                  <destFileName>jboss-system.jar</destFileName>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.jboss.jbossas</groupId>
+                  <artifactId>jboss-as-system-jmx</artifactId>
+                  <version>${version.org.jboss.jbossas}</version>
+                  <destFileName>jboss-system-jmx.jar</destFileName>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.jboss.jbossas</groupId>
+                  <artifactId>jboss-as-varia</artifactId>
+                  <version>${version.org.jboss.jbossas}</version>
+                  <classifier>jboss-bindingservice</classifier>
+                  <! - - TODO: fix me, bindingservice doesn't really belong here - - >
+                  <outputDirectory>${project.build.directory}/dist/common/lib</outputDirectory>
+                  <destFileName>jboss-bindingservice.jar</destFileName>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.jboss.mx</groupId>
+                  <artifactId>jboss-j2se</artifactId>
+                  <version>${version.org.jboss.mx}</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.jboss.mx</groupId>
+                  <artifactId>jboss-jmx</artifactId>
+                  <version>${version.org.jboss.mx}</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.jboss.mx</groupId>
+                  <artifactId>jboss-mbeans</artifactId>
+                  <version>${version.org.jboss.mx}</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>oswego-concurrent</groupId>
+                  <artifactId>concurrent</artifactId>
+                  <version>1.3.4-jboss-update1</version>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>sun-jaxb</groupId>
+                  <artifactId>jaxb-impl</artifactId>
+                  <version>2.1.9</version>
+                </artifactItem>
+              </artifactItems>
+              <outputDirectory>${project.build.directory}/dist/lib</outputDirectory>
+              <stripVersion>true</stripVersion>
+            </configuration>
+          </execution>
+          -->
+        </executions>
+      </plugin>
+      <!-- if we add a Class-Path we can't add new additions, which are needed by a specific bootstrap -->
+      <!-- 
+      <plugin>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifest>
+              <addClasspath>true</addClasspath>
+              < ! - - maven-archiver 2.4 - - >
+              <classpathLayoutType>custom</classpathLayoutType>
+              <customClasspathLayout>lib/$${artifact.artifactId}$${dashClassifier?}.$${artifact.extension}</customClasspathLayout>
+              <mainClass>org.jboss.reloaded.main.Main</mainClass>
+            </manifest>
+          </archive>
+        </configuration>
+        <dependencies>
+          <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-archiver</artifactId>
+            <version>2.4</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+      -->
+      <!--
+      <plugin>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>2.3</version>
+        <executions>
+          <execution>
+            <id>copy-resources</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>copy-resources</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${project.build.directory}/dist</outputDirectory>
+              <resources>          
+                <resource>
+                  <directory>src/main/resources</directory>
+                </resource>
+              </resources>
+            </configuration>            
+          </execution>
+        </executions>
+      </plugin>
+      -->
+    </plugins>
+  </build>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+         <groupId>org.jboss.man</groupId>
+         <artifactId>jboss-managed</artifactId>
+         <version>2.1.0.CR5</version>
+       </dependency>
+    </dependencies>
+  </dependencyManagement>
+  
+  <dependencies>
+    <!-- used in OptionParser -->
+    <dependency>
+      <groupId>gnu-getopt</groupId>
+      <artifactId>getopt</artifactId>
+      <version>1.0.12-brew</version>
+    </dependency>
+    <!-- test cases -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.4</version>
+      <scope>test</scope>
+    </dependency>
+    <!-- vfs.xml -->
+    <!--
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-vfs</artifactId>
+      <version>2.1.0.GA</version>
+      <scope>runtime</scope>
+    </dependency>
+    -->
+    <!-- excluded from jboss-aop-mc-int -->
+    <dependency>
+      <groupId>org.jboss.aop</groupId>
+      <artifactId>jboss-aop</artifactId>
+      <version>${version.org.jboss.aop}</version>
+      <scope>runtime</scope>
+      <exclusions>
+        <!-- TODO: does AOP really depend on Ant? -->
+        <exclusion>
+          <groupId>org.apache.ant</groupId>
+          <artifactId>ant</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <!-- bootstrap.xml -->
+    <dependency>
+      <groupId>org.jboss.bootstrap</groupId>
+      <artifactId>jboss-bootstrap</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+    </dependency>
+    <!-- test case -->
+    <!--
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-client</artifactId>
+      <version>2.0.5.GA</version>
+      <scope>test</scope>
+    </dependency>
+    -->
+    <!-- urn:jboss:classloader:1.0 -->
+    <!--
+    <dependency>
+      <groupId>org.jboss.cl</groupId>
+      <artifactId>jboss-classloading-vfs</artifactId>
+      <version>2.0.4.GA</version>
+      <scope>runtime</scope>
+    </dependency>
+    -->
+    <!-- 
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-spi</artifactId>
+      <version>2.0.5.GA</version>
+      <scope>runtime</scope>
+    </dependency>
+    -->
+    <!-- logging.xml -->
+    <!--
+    <dependency>
+      <groupId>org.jboss.logbridge</groupId>
+      <artifactId>jboss-logbridge</artifactId>
+      <version>1.0.0.CR3</version>
+      <scope>runtime</scope>
+    </dependency>
+    -->
+    <!-- jboss-logbridge has a dependency on org.jboss.logging.log4j.JDKLevel, but doesn't declare it -->
+    <!--
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-log4j</artifactId>
+      <version>2.0.6.GA</version>
+      <scope>runtime</scope>
+    </dependency>
+    -->
+    <!-- urn:jboss:aop-beans:1.0 -->
+    <!--
+    <dependency>
+      <groupId>org.jboss.microcontainer</groupId>
+      <artifactId>jboss-aop-mc-int</artifactId>
+      <version>2.0.4.GA</version>
+      <scope>runtime</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss.aop</groupId>
+          <artifactId>jboss-aop</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    -->
+  </dependencies>
+</project>

Added: projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/main/Main.java
===================================================================
--- projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/main/Main.java	                        (rev 0)
+++ projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/main/Main.java	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.reloaded.main;
+
+import java.net.URLClassLoader;
+import java.util.Arrays;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.FutureTask;
+
+import org.jboss.reloaded.main.options.Option;
+import org.jboss.reloaded.main.options.OptionParser;
+import org.jboss.reloaded.server.ReloadedServerImpl;
+import org.jboss.reloaded.spi.ReloadedServerConfig;
+import org.jboss.reloaded.spi.ReloadedServerConfigFactory;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class Main
+{
+   private static String programName = System.getProperty("program.name", Main.class.getName());
+   
+   private String configuration = "default";
+   
+   public void boot(String args[]) throws Exception
+   {
+      OptionParser.process(this, args);
+      
+      ReloadedServerConfig config = ReloadedServerConfigFactory.createConfig();
+      config.setServerName(configuration);
+      // TODO: more bits and pieces
+      ReloadedServerImpl.create(config);
+   }
+   
+   @Option(value="help", description="show this help message")
+   public static void help()
+   {
+      System.out.println("usage: " + programName + " [options]");
+      System.out.println();
+      System.out.println("options:");
+      System.out.println("    -h, --help                    Show this help message");
+      System.out.println("    -V, --version                 Show version information");
+//      System.out.println("    --                            Stop processing options");
+      System.out.println("    -D<name>[=<value>]            Set a system property");
+//      System.out.println("    -d, --bootdir=<dir>           Set the boot patch directory; Must be absolute or url");
+//      System.out.println("    -p, --patchdir=<dir>          Set the patch directory; Must be absolute or url");
+//      System.out.println("    -n, --netboot=<url>           Boot from net with the given url as base");
+      System.out.println("    -c, --configuration=<name>    Set the server configuration name");
+//      System.out.println("    -B, --bootlib=<filename>      Add an extra library to the front bootclasspath");
+//      System.out.println("    -L, --library=<filename>      Add an extra library to the loaders classpath");
+//      System.out.println("    -C, --classpath=<url>         Add an extra url to the loaders classpath");
+//      System.out.println("    -P, --properties=<url>        Load system properties from the given url");
+//      System.out.println("    -b, --host=<host or ip>       Bind address for all JBoss services");
+//      System.out.println("    -g, --partition=<name>        HA Partition name (default=DefaultDomain)");
+//      System.out.println("    -m, --mcast_port=<ip>         UDP multicast port; only used by JGroups");
+//      System.out.println("    -u, --udp=<ip>                UDP multicast address");
+//      System.out.println("    -l, --log=<log4j|jdk>         Specify the logger plugin type");
+      System.out.println();
+      System.exit(0);
+   }
+   
+   /**
+    * This is where the magic begins.
+    *
+    * <P>Starts up inside of a "jboss-reloaded" thread group to allow better
+    *    identification of JBoss Reloaded threads.
+    *
+    * @param args    The command line arguments.
+    * @throws Exception for any error
+    */
+   public static void main(final String args[]) throws Exception
+   {
+      URLClassLoader loader = (URLClassLoader) Thread.currentThread().getContextClassLoader();
+      System.err.println(loader);
+      System.err.println(Arrays.toString(loader.getURLs()));
+      
+      Callable<Void> callable = new Callable<Void>() {
+         public Void call() throws Exception
+         {
+            Main main = new Main();
+            main.boot(args);
+            return null;
+         }
+      };
+      FutureTask<Void> worker = new FutureTask<Void>(callable);
+      ThreadGroup threads = new ThreadGroup("jboss-reloaded");
+      new Thread(threads, worker, "main").start();
+      try
+      {
+         worker.get();
+      }
+      catch (ExecutionException e)
+      {
+         Throwable cause = e.getCause();
+         if(cause instanceof Error)
+            throw (Error) cause;
+         if(cause instanceof RuntimeException)
+            throw (RuntimeException) cause;
+         throw (Exception) cause;
+      }
+   }
+   
+   @Option(value="configuration", description="set the server configuration name")
+   public void setConfiguration(String conf)
+   {
+      this.configuration = conf;
+   }
+   
+   @Option(value="property", description="set a system property ( <name>[=<value>] )", character='D')
+   public void setProperty(String expr)
+   {
+      throw new RuntimeException("NYI");
+   }
+   
+   @Option(value="version", description="show version information")
+   public static void version()
+   {
+      Package jbossPackage = Main.class.getPackage();
+
+      // show version information
+      System.out.println("JBoss " + jbossPackage.getImplementationVersion());
+      System.out.println();
+      System.out.println("Distributable under LGPL license.");
+      System.out.println("See terms of license at gnu.org.");
+      System.out.println();
+      System.exit(0);
+   }
+}

Added: projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/main/options/Option.java
===================================================================
--- projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/main/options/Option.java	                        (rev 0)
+++ projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/main/options/Option.java	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.reloaded.main.options;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Retention(RUNTIME)
+ at Target({ METHOD, FIELD })
+public @interface Option {
+   char character() default 0;
+   
+   String value();
+   
+   String description();
+}

Added: projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/main/options/OptionParser.java
===================================================================
--- projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/main/options/OptionParser.java	                        (rev 0)
+++ projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/main/options/OptionParser.java	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.reloaded.main.options;
+
+import gnu.getopt.Getopt;
+import gnu.getopt.LongOpt;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class OptionParser
+{
+   public static void process(Object obj, String args[])
+   {
+      Class<?> cls;
+      if(obj instanceof Class)
+         cls = (Class<?>) obj;
+      else
+         cls = obj.getClass();
+      
+      String sopts = "";
+      List<LongOpt> lopts = new ArrayList<LongOpt>();
+      Map<Character, AccessibleObject> targets = new HashMap<Character, AccessibleObject>();
+      
+      Method[] methods = cls.getMethods();
+      for(Method method : methods)
+      {
+         Option option = method.getAnnotation(Option.class);
+         if(option == null)
+            continue;
+         
+         char ch = option.value().charAt(0);
+         sopts += ch;
+         if(method.getParameterTypes().length > 0)
+            sopts += ":";
+         
+         int hasArg = LongOpt.NO_ARGUMENT;
+         if(method.getParameterTypes().length > 0)
+            hasArg = LongOpt.REQUIRED_ARGUMENT;
+         // TODO: optional argument
+         
+         lopts.add(new LongOpt(option.value(), hasArg, null, ch));
+         targets.put(ch, method);
+      }
+      // TODO
+      String programName = cls.getName();
+      
+      Getopt getopt = new Getopt(programName, args, sopts, lopts.toArray(new LongOpt[0]));
+      int c;
+      while((c = getopt.getopt()) != -1)
+      {
+         int i = getopt.getLongind();
+         if(i == -1)
+            throw new IllegalArgumentException("unrecognized option encountered");
+         String arg = getopt.getOptarg();
+         AccessibleObject target = targets.get((char) c);
+         if(target instanceof Method)
+         {
+            Method method = (Method) target;
+            try
+            {
+               if(method.getParameterTypes().length > 0)
+               {
+                  Object methodArgs[] = { arg };
+                  method.invoke(obj, methodArgs);
+               }
+               else
+               {
+                  method.invoke(obj);
+               }
+            }
+            catch(InvocationTargetException e)
+            {
+               throw new RuntimeException(e);
+            }
+            catch (IllegalArgumentException e)
+            {
+               throw new RuntimeException(e);
+            }
+            catch (IllegalAccessException e)
+            {
+               throw new RuntimeException(e);
+            }
+         }
+         else
+            throw new RuntimeException("NYI for '" + (char) c + "' " + targets);
+      }
+   }
+}

Added: projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/server/ReloadedServerConfigImpl.java
===================================================================
--- projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/server/ReloadedServerConfigImpl.java	                        (rev 0)
+++ projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/server/ReloadedServerConfigImpl.java	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,204 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.reloaded.server;
+
+import java.io.File;
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.Properties;
+
+import org.jboss.bootstrap.microcontainer.ServerImpl;
+import org.jboss.bootstrap.spi.ServerConfig;
+import org.jboss.reloaded.spi.ReloadedServerConfig;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ReloadedServerConfigImpl implements ReloadedServerConfig
+{
+   private String bootstrapDir;
+   private URL bootstrapDirURL;
+   private URL bootstrapURL;
+   private String homeDir;
+   private URL libraryURL;
+   private Properties properties = new Properties();
+   private String serverName = "default";
+
+   private static URL findResourceBase(String resourceName)
+   {
+      ClassLoader loader = Thread.currentThread().getContextClassLoader();
+      URL url = loader.getResource(resourceName);
+      if(url == null)
+         return null;
+      String spec = url.toExternalForm();
+      try
+      {
+         return new URL(spec.substring(0, spec.length() - resourceName.length()));
+      }
+      catch(MalformedURLException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+   
+   // FIXME
+   public InetAddress getServerBindAddress()
+   {
+      try
+      {
+         return InetAddress.getByName("localhost");
+      }
+      catch (UnknownHostException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+   
+   public URL getBootstrapDirURL()
+   {
+      if(bootstrapDirURL != null)
+         return bootstrapDirURL;
+      
+      // TODO: a bit of cleanup, so the resource finding works more generically
+      
+      try
+      {
+         String resourceName = ServerConfig.SERVER_BASE_URL_SUFFIX + getServerName() + "/" + ServerConfig.SERVER_CONFIG_URL_SUFFIX + getBootstrapName();
+         URL url = findResourceBase(resourceName);
+         if(url == null)
+         {
+            //throw new IllegalStateException("No bootstrapDirectoryURL specified and '" + resourceName + "' was not found on the class path");
+            url = getHomeDirURL();
+         }
+         /*
+          * org.jboss.xb.binding.JBossXBException: Failed to parse source: jar:file:/.../jboss-reloaded-vdf-bootstrap-0.1.0-SNAPSHOT.jar!//server/default/conf/bootstrap.xml
+          */
+         String spec = url.toExternalForm();
+         if(!spec.endsWith("/"))
+            spec += "/";
+         return new URL(spec + ServerConfig.SERVER_BASE_URL_SUFFIX + getServerName() + "/" + ServerConfig.SERVER_CONFIG_URL_SUFFIX);
+      }
+      catch (MalformedURLException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+   
+   public String getBootstrapName()
+   {
+      return ServerImpl.BOOTSTRAP_XML_NAME;
+   }
+   
+   public String getHomeDir()
+   {
+      if(homeDir != null)
+         return homeDir;
+      
+      String dir = System.getProperty("jboss.home", null);
+      if(dir != null)
+         return dir;
+      
+      dir = System.getenv("JBOSS_HOME");
+      if(dir != null)
+         return dir;
+      
+      String resourceName = ServerConfig.SERVER_BASE_URL_SUFFIX + getServerName() + "/" + ServerConfig.SERVER_CONFIG_URL_SUFFIX + getRootDeploymentFilename();
+      URL url = findResourceBase(resourceName);
+      if(url == null)
+         throw new IllegalStateException("No homeDir specified and '" + resourceName + "' was not found on the class path");
+      
+      try
+      {
+         return new File(url.toURI()).getAbsolutePath();
+      }
+      catch(URISyntaxException e)
+      {
+         throw new IllegalStateException(e);
+      }
+   }
+   
+   protected URL getHomeDirURL() throws MalformedURLException
+   {
+      return new File(getHomeDir()).toURI().toURL();
+   }
+
+   public Properties getProperties()
+   {
+      return properties;
+   }
+
+   public String getRootDeploymentFilename()
+   {
+      return ServerConfig.DEFAULT_ROOT_DEPLOYMENT_FILENAME;
+   }
+   
+   public String getServerName()
+   {
+      return serverName;
+   }
+   
+   public ReloadedServerConfig setBootstrapDir(String bootstrapDir)
+   {
+      this.bootstrapDir = bootstrapDir;
+      return this;
+   }
+
+   public ReloadedServerConfig setBootstrapDirURL(URL bootstrapDirURL)
+   {
+      this.bootstrapDirURL = bootstrapDirURL;
+      return this;
+   }
+
+   public ReloadedServerConfig setBootstrapURL(URL bootstrapURL)
+   {
+      this.bootstrapURL = bootstrapURL;
+      return this;
+   }
+
+   public ReloadedServerConfig setHomeDir(String homeDir)
+   {
+      this.homeDir = homeDir;
+      return this;
+   }
+
+   public ReloadedServerConfig setLibraryURL(URL libraryURL)
+   {
+      this.libraryURL = libraryURL;
+      return this;
+   }
+
+   public ReloadedServerConfig setProperties(Properties props)
+   {
+      this.properties = props;
+      return this;
+   }
+
+   public ReloadedServerConfig setServerName(String serverName)
+   {
+      this.serverName  = serverName;
+      return this;
+   }
+}

Added: projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/server/ReloadedServerImpl.java
===================================================================
--- projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/server/ReloadedServerImpl.java	                        (rev 0)
+++ projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/server/ReloadedServerImpl.java	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,168 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.reloaded.server;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jboss.bootstrap.microcontainer.ServerImpl;
+import org.jboss.bootstrap.spi.ServerConfig;
+import org.jboss.bootstrap.spi.microcontainer.MCServer;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.reloaded.spi.ReloadedServer;
+import org.jboss.reloaded.spi.ReloadedServerConfig;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ReloadedServerImpl implements ReloadedServer
+{
+   private MCServer delegate;
+
+   /**
+    * Creates an initialized and started Reloaded server.
+    * 
+    * @param config
+    * @return
+    */
+   public static ReloadedServer create(ReloadedServerConfig config) throws Exception
+   {
+      ReloadedServerImpl server = new ReloadedServerImpl(new ServerImpl());
+      Properties props = config.getProperties();
+      if(!props.containsKey(ServerConfig.HOME_DIR))
+         props.setProperty(ServerConfig.HOME_DIR, config.getHomeDir());
+      if(!props.containsKey(ServerConfig.SERVER_BIND_ADDRESS))
+         props.setProperty(ServerConfig.SERVER_BIND_ADDRESS, config.getServerBindAddress().getHostAddress());
+      // FIXME
+      System.setProperty(ServerConfig.SERVER_BIND_ADDRESS, props.getProperty(ServerConfig.SERVER_BIND_ADDRESS));
+      // TODO: this is not really supported by Bootstrap, so we fake it
+      if(!props.containsKey(ServerConfig.SERVER_CONFIG_URL))
+         props.setProperty(ServerConfig.SERVER_CONFIG_URL, config.getBootstrapDirURL().toExternalForm());
+      System.out.println(props);
+      server.init(props);
+      server.start();
+      return server;
+   }
+   
+   protected ReloadedServerImpl(MCServer delegate)
+   {
+      this.delegate = delegate;
+   }
+   
+   public String getBuildDate()
+   {
+      return delegate.getBuildDate();
+   }
+
+   public String getBuildID()
+   {
+      return delegate.getBuildID();
+   }
+
+   public String getBuildJVM()
+   {
+      return delegate.getBuildJVM();
+   }
+
+   public String getBuildNumber()
+   {
+      return delegate.getBuildNumber();
+   }
+
+   public String getBuildOS()
+   {
+      return delegate.getBuildOS();
+   }
+
+   public ServerConfig getConfig() throws IllegalStateException
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public Map<String, KernelDeployment> getDeployments()
+   {
+      return delegate.getDeployments();
+   }
+
+   public Kernel getKernel()
+   {
+      return delegate.getKernel();
+   }
+
+   public Map<String, Object> getMetaData()
+   {
+      return delegate.getMetaData();
+   }
+
+   public Date getStartDate()
+   {
+      return delegate.getStartDate();
+   }
+
+   public String getVersion()
+   {
+      return delegate.getVersion();
+   }
+
+   public String getVersionName()
+   {
+      return delegate.getVersionName();
+   }
+
+   public String getVersionNumber()
+   {
+      return delegate.getVersionNumber();
+   }
+
+   public void init(Properties props, Map<String, Object> metaData) throws IllegalStateException, Exception
+   {
+      delegate.init(props, metaData);
+   }
+
+   public void init(Properties props) throws IllegalStateException, Exception
+   {
+      delegate.init(props);
+   }
+
+   public boolean isInShutdown()
+   {
+      return delegate.isInShutdown();
+   }
+
+   public boolean isStarted()
+   {
+      return delegate.isStarted();
+   }
+
+   public void shutdown() throws IllegalStateException
+   {
+      delegate.shutdown();
+   }
+
+   public void start() throws IllegalStateException, Exception
+   {
+      delegate.start();
+   }
+}

Added: projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/spi/ReloadedServer.java
===================================================================
--- projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/spi/ReloadedServer.java	                        (rev 0)
+++ projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/spi/ReloadedServer.java	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.reloaded.spi;
+
+import org.jboss.bootstrap.spi.microcontainer.MCServer;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface ReloadedServer extends MCServer
+{
+
+}

Added: projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/spi/ReloadedServerConfig.java
===================================================================
--- projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/spi/ReloadedServerConfig.java	                        (rev 0)
+++ projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/spi/ReloadedServerConfig.java	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.reloaded.spi;
+
+import java.net.InetAddress;
+import java.net.URL;
+import java.util.Properties;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface ReloadedServerConfig
+{
+   URL getBootstrapDirURL();
+   
+   String getHomeDir();
+   
+   Properties getProperties();
+   
+   InetAddress getServerBindAddress();
+   
+   String getServerName();
+   
+   /**
+    * Per default Reloaded looks for a resource called "bootstrap.xml" and
+    * use that (virtual) directory.
+    * 
+    * @param bootstrapDir
+    * @return
+    */
+   ReloadedServerConfig setBootstrapDir(String bootstrapDir);
+   
+   ReloadedServerConfig setBootstrapDirURL(URL bootstrapDirURL);
+   
+   ReloadedServerConfig setBootstrapURL(URL bootstrapURL);
+   
+   ReloadedServerConfig setHomeDir(String homeDir);
+   
+   /**
+    * The URL containing the libraries referenced in bootstrap descriptors
+    * with ${jboss.lib.url}.
+    * 
+    * @param libraryURL
+    * @return
+    */
+   ReloadedServerConfig setLibraryURL(URL libraryURL);
+   
+   ReloadedServerConfig setProperties(Properties props);
+   
+   /**
+    * ${jboss.server.name}
+    * 
+    * @param profileName
+    * @return
+    */
+   ReloadedServerConfig setServerName(String serverName);
+}

Added: projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/spi/ReloadedServerConfigFactory.java
===================================================================
--- projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/spi/ReloadedServerConfigFactory.java	                        (rev 0)
+++ projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/spi/ReloadedServerConfigFactory.java	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.reloaded.spi;
+
+import org.jboss.reloaded.server.ReloadedServerConfigImpl;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ReloadedServerConfigFactory
+{
+   public static ReloadedServerConfig createConfig()
+   {
+      /*
+      ClassLoader loader = Thread.currentThread().getContextClassLoader();
+      Class<?> interfaces[] = { ReloadedServerConfig.class };
+      InvocationHandler handler = new DynamicPropertyHandler();
+      ReloadedServerConfig config = (ReloadedServerConfig) Proxy.newProxyInstance(loader, interfaces, handler);
+      
+      // TODO: default values
+      config.setProperties(new Properties());
+      
+      return config;
+      */
+      return new ReloadedServerConfigImpl();
+   }
+}

Added: projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/util/DynamicPropertyHandler.java
===================================================================
--- projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/util/DynamicPropertyHandler.java	                        (rev 0)
+++ projects/reloaded/trunk/main/src/main/java/org/jboss/reloaded/util/DynamicPropertyHandler.java	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.reloaded.util;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class DynamicPropertyHandler implements InvocationHandler
+{
+   private Map<String, Object> properties = new ConcurrentHashMap<String, Object>();
+   
+   protected static boolean isGetter(Method method)
+   {
+      String name = method.getName();
+      Class<?> returnType = method.getReturnType();
+      Class<?>[] parameters = method.getParameterTypes();
+      if ((name.length() > 3 && name.startsWith("get")) || (name.length() > 2 && name.startsWith("is")))
+      {
+         // isBoolean() is not a getter for java.lang.Boolean
+         if (name.startsWith("is") && Boolean.class.equals(returnType) == false)
+            return false;
+         if (parameters.length == 0 && Void.TYPE.equals(returnType) == false)
+            return true;
+      }
+      return false;
+   }
+   
+   protected static boolean isSetter(Method method, Class<?> optionalReturnType)
+   {
+      String name = method.getName();
+      Class<?> returnType = method.getReturnType();
+      Class<?>[] parameters = method.getParameterTypes();
+      if ((name.length() > 3 && name.startsWith("set")))
+      {
+         if (parameters.length == 1)
+         {
+            // a simple setter
+            if(Void.TYPE.equals(returnType))
+               return true;
+            if(returnType.isAssignableFrom(optionalReturnType))
+               return true;
+         }
+      }
+      return false;
+   }
+   
+   protected static String getPropertyName(String name)
+   {
+      int start = 3;
+      if (name.startsWith("is"))
+         start = 2;
+      
+      name = name.substring(start);
+      
+      // If the second character is upper case then we don't make
+      // the first character lower case
+      if (name.length() > 1)
+      {
+         if (Character.isUpperCase(name.charAt(1)))
+            return name;
+      }
+
+      JBossStringBuilder buffer = new JBossStringBuilder(name.length());
+      buffer.append(Character.toLowerCase(name.charAt(0)));
+      if (name.length() > 1)
+         buffer.append(name.substring(1));
+      return buffer.toString();
+   }
+   
+   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+   {
+      String methodName = method.getName();
+      Class<?> optionalReturnType = proxy.getClass();
+      if(isGetter(method))
+      {
+         String propertyName = getPropertyName(methodName);
+         Object value = properties.get(propertyName);
+         if(value == null)
+            throw new NullPointerException(propertyName + " is null");
+         //if(!method.getReturnType().isAssignableFrom(value.getClass()))
+         return value;
+      }
+      else if(isSetter(method, optionalReturnType))
+      {
+         String propertyName = getPropertyName(methodName);
+         properties.put(propertyName, args[0]);
+         if(method.getReturnType().isAssignableFrom(optionalReturnType))
+            return proxy;
+         else
+            return null;
+      }
+      throw new UnsupportedOperationException("can't execute " + method);
+   }
+}

Added: projects/reloaded/trunk/main/src/test/java/org/jboss/reloaded/main/test/main/unit/MainTestCase.java
===================================================================
--- projects/reloaded/trunk/main/src/test/java/org/jboss/reloaded/main/test/main/unit/MainTestCase.java	                        (rev 0)
+++ projects/reloaded/trunk/main/src/test/java/org/jboss/reloaded/main/test/main/unit/MainTestCase.java	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.reloaded.main.test.main.unit;
+
+import org.jboss.reloaded.main.Main;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class MainTestCase
+{
+   @Test
+   public void test1() throws Exception
+   {
+      String args[] = { };
+      Main.main(args);
+   }
+}

Added: projects/reloaded/trunk/main/src/test/resources/log4j.xml
===================================================================
--- projects/reloaded/trunk/main/src/test/resources/log4j.xml	                        (rev 0)
+++ projects/reloaded/trunk/main/src/test/resources/log4j.xml	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 68671 2008-01-08 10:04:25Z wolfc $ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+  <!-- ================================= -->
+  <!-- Preserve messages in a local file -->
+  <!-- ================================= -->
+
+  <!-- A time/date based rolling appender -->
+  <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+    <param name="File" value="target/test.log"/>
+    <param name="Append" value="false"/>
+
+    <!-- Rollover at midnight each day -->
+    <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+    <!-- Rollover at the top of each hour
+    <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+    -->
+
+    <layout class="org.apache.log4j.PatternLayout">
+      <!-- The default pattern: Date Priority [Category] Message\n -->
+      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+      <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+      <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+       -->
+    </layout>	    
+  </appender>
+
+  <!-- A size based file rolling appender
+  <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+    <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
+    <param name="Append" value="false"/>
+    <param name="MaxFileSize" value="500KB"/>
+    <param name="MaxBackupIndex" value="1"/>
+
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+    </layout>	    
+  </appender>
+  -->
+
+  <!-- ============================== -->
+  <!-- Append messages to the console -->
+  <!-- ============================== -->
+
+  <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+    <param name="Target" value="System.out"/>
+    <param name="Threshold" value="ALL"/>
+
+    <layout class="org.apache.log4j.PatternLayout">
+      <!-- The default pattern: Date Priority [Category] Message\n -->
+      <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+    </layout>
+  </appender>
+
+
+  <!-- ================ -->
+  <!-- Limit categories -->
+  <!-- ================ -->
+
+  <!-- Limit JBoss categories to INFO
+  <category name="org.jboss">
+    <priority value="INFO" class="org.jboss.logging.XLevel"/>
+  </category>
+  -->
+
+  <!-- Increase the priority threshold for the DefaultDS category
+  <category name="DefaultDS">
+    <priority value="FATAL"/>
+  </category>
+  -->
+
+  <!-- Decrease the priority threshold for the org.jboss.varia category
+  <category name="org.jboss.varia">
+    <priority value="DEBUG"/>
+  </category>
+  -->
+
+  <!--
+     | An example of enabling the custom TRACE level priority that is used
+     | by the JBoss internals to diagnose low level details. This example
+     | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
+     | subpackages. This will produce A LOT of logging output.
+  <category name="org.jboss.system">
+    <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+  </category>
+  -->
+
+  <category name="org.jboss">
+    <priority value="INFO"/>
+  </category>
+  
+  <!-- ======================= -->
+  <!-- Setup the Root category -->
+  <!-- ======================= -->
+
+  <root>
+    <priority value="WARN" />
+    <appender-ref ref="CONSOLE"/>
+    <appender-ref ref="FILE"/>
+  </root>
+  
+</log4j:configuration>

Added: projects/reloaded/trunk/main/src/test/resources/server/default/conf/bootstrap/dummy.xml
===================================================================
--- projects/reloaded/trunk/main/src/test/resources/server/default/conf/bootstrap/dummy.xml	                        (rev 0)
+++ projects/reloaded/trunk/main/src/test/resources/server/default/conf/bootstrap/dummy.xml	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+</deployment>
\ No newline at end of file

Added: projects/reloaded/trunk/main/src/test/resources/server/default/conf/bootstrap.xml
===================================================================
--- projects/reloaded/trunk/main/src/test/resources/server/default/conf/bootstrap.xml	                        (rev 0)
+++ projects/reloaded/trunk/main/src/test/resources/server/default/conf/bootstrap.xml	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   The list of URLs for mc beans to load during bootstrap.
+-->
+<bootstrap xmlns="urn:jboss:bootstrap:1.0">
+   <url>bootstrap/dummy.xml</url>
+</bootstrap>
\ No newline at end of file

Added: projects/reloaded/trunk/main/src/test/resources/server/default/conf/jboss-service.xml
===================================================================
--- projects/reloaded/trunk/main/src/test/resources/server/default/conf/jboss-service.xml	                        (rev 0)
+++ projects/reloaded/trunk/main/src/test/resources/server/default/conf/jboss-service.xml	2009-04-02 21:42:44 UTC (rev 86700)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- ===================================================================== -->
+<!--  JBoss Server Configuration                                           -->
+<!-- ===================================================================== -->
+<server>
+</server>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list