[jboss-cvs] JBossAS SVN: r84782 - in projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap: spi and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 26 02:12:01 EST 2009


Author: ALRubinger
Date: 2009-02-26 02:12:01 -0500 (Thu, 26 Feb 2009)
New Revision: 84782

Modified:
   projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/AbstractServerImpl.java
   projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/BaseServerConfig.java
   projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/spi/ServerConfig.java
Log:
[JBBOOT-15] Use j.i.File backing for ServerConfig until at least AS integration is done, then revisit VFS-backing as shown by JBBOOT-4

Modified: projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/AbstractServerImpl.java
===================================================================
--- projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/AbstractServerImpl.java	2009-02-26 06:21:22 UTC (rev 84781)
+++ projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/AbstractServerImpl.java	2009-02-26 07:12:01 UTC (rev 84782)
@@ -21,6 +21,7 @@
  */
 package org.jboss.bootstrap;
 
+import java.io.File;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.Collections;
@@ -43,7 +44,6 @@
 import org.jboss.managed.api.annotation.ManagementProperty;
 import org.jboss.net.protocol.URLStreamHandlerFactory;
 import org.jboss.util.StopWatch;
-import org.jboss.virtual.VirtualFile;
 
 /**
  * A Server implementation that uses the deployer-beans.xml and ProfileService
@@ -194,8 +194,8 @@
       if (overrideTmpDir)
       {
          //File serverTmpDir = config.getServerTempDir(); //TODO Put this back when we go back to File 
-         VirtualFile serverTmpDir = config.getServerTempDir();
-         System.setProperty("java.io.tmpdir", serverTmpDir.getPathName());
+         File serverTmpDir = config.getServerTempDir();
+         System.setProperty("java.io.tmpdir", serverTmpDir.toString());
       }
 
       // Initialize the logging layer using the ServerImpl class. The server log

Modified: projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/BaseServerConfig.java
===================================================================
--- projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/BaseServerConfig.java	2009-02-26 06:21:22 UTC (rev 84781)
+++ projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/BaseServerConfig.java	2009-02-26 07:12:01 UTC (rev 84782)
@@ -47,9 +47,7 @@
 import org.jboss.util.Null;
 import org.jboss.util.Primitives;
 import org.jboss.util.platform.Java;
-import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VFSUtils;
 
 /**
  * A container for the basic configuration elements required to create
@@ -78,7 +76,7 @@
    private Properties props;
 
    private URL bootstrapURL;
-   private VirtualFile homeDir;
+   private File homeDir;
    private URL homeURL;
    private URL libraryURL;
 
@@ -94,11 +92,11 @@
    private String serverSpecificationVersion;
 
    private String serverName;
-   private VirtualFile serverBaseDir;
-   private VirtualFile serverHomeDir;
-   private VirtualFile serverLogDir;
-   private VirtualFile serverTempDir;
-   private VirtualFile serverDataDir;
+   private File serverBaseDir;
+   private File serverHomeDir;
+   private File serverLogDir;
+   private File serverTempDir;
+   private File serverDataDir;
    private URL serverBaseURL;
    private URL serverHomeURL;
    private URL serverLibraryURL;
@@ -131,7 +129,7 @@
       homeDir = getFile(ServerConfig.HOME_DIR);
       if (homeDir == null)
          throw new Exception("Missing configuration value for: " + ServerConfig.HOME_DIR);
-      System.setProperty(ServerConfig.HOME_DIR, toPathName(homeDir));
+      System.setProperty(ServerConfig.HOME_DIR, homeDir.toString());
       // Setup the SERVER_HOME_DIR system property
       getServerHomeDir();
 
@@ -151,14 +149,10 @@
       // If not set then default to homeDir
       homeURL = getURL(ServerConfig.HOME_URL);
       if (homeURL == null)
-         try
-         {
-            homeURL = homeDir.toURL();
-         }
-         catch (URISyntaxException e)
-         {
-            throw new RuntimeException(e);
-         }
+      {
+         homeURL = homeDir.toURL();
+      }
+         
       System.setProperty(ServerConfig.HOME_URL, homeURL.toString());
    }
 
@@ -190,7 +184,7 @@
    @ManagementProperty(description = "the local home directory which the server is running from", use =
    {ViewUse.STATISTIC})
    @MetaMapping(FileMetaMapper.class)
-   public VirtualFile getHomeDir()
+   public File getHomeDir()
    {
       return homeDir;
    }
@@ -268,7 +262,7 @@
    @ManagementProperty(description="the base directory for calculating server home directories",
          use={ViewUse.STATISTIC})
    @MetaMapping(FileMetaMapper.class)
-   public VirtualFile getServerBaseDir()
+   public File getServerBaseDir()
    {
       if (serverBaseDir == null)
       {
@@ -277,13 +271,13 @@
          {
             try
             {
-               serverBaseDir = VFS.getVirtualFile(homeDir.toURL(), ServerConfig.SERVER_BASE_DIR_SUFFIX);
+               serverBaseDir = new File(homeDir, ServerConfig.SERVER_BASE_DIR_SUFFIX);
             }
             catch (Exception e)
             {
                throw new RuntimeException(e);
             }
-            System.setProperty(ServerConfig.SERVER_BASE_DIR, toPathName(serverBaseDir));
+            System.setProperty(ServerConfig.SERVER_BASE_DIR, serverBaseDir.toString());
          }
       }
       return serverBaseDir;
@@ -292,7 +286,7 @@
    @ManagementProperty(description="the server home directory",
          use={ViewUse.STATISTIC})
    @MetaMapping(FileMetaMapper.class)
-   public VirtualFile getServerHomeDir()
+   public File getServerHomeDir()
    {
       if (serverHomeDir == null)
       {
@@ -301,13 +295,13 @@
          {
             try
             {
-               serverHomeDir = VFS.getVirtualFile(getServerBaseDir().toURL(), getServerName());
+               serverHomeDir = new File(getServerBaseDir(), getServerName());
             }
             catch (Exception e)
             {
                throw new RuntimeException(e);
             }
-            System.setProperty(ServerConfig.SERVER_HOME_DIR, toPathName(serverHomeDir));
+            System.setProperty(ServerConfig.SERVER_HOME_DIR, serverHomeDir.toString());
          }
       }
       return serverHomeDir;
@@ -324,7 +318,7 @@
    @ManagementProperty(description="the server log directory",
          use={ViewUse.STATISTIC})
    @MetaMapping(FileMetaMapper.class)
-   public VirtualFile getServerLogDir()
+   public File getServerLogDir()
    {
       if (serverLogDir == null)
       {
@@ -333,13 +327,13 @@
          {
             try
             {
-               serverLogDir = VFS.getVirtualFile(getServerHomeDir().toURL(), ServerConfig.SERVER_LOG_DIR_SUFFIX);
+               serverLogDir = new File(getServerHomeDir(), ServerConfig.SERVER_LOG_DIR_SUFFIX);
             }
             catch (Exception e)
             {
                throw new RuntimeException(e);
             }
-            System.setProperty(ServerConfig.SERVER_LOG_DIR, toPathName(serverLogDir));
+            System.setProperty(ServerConfig.SERVER_LOG_DIR, serverLogDir.toString());
          }
       }
       return serverLogDir;
@@ -353,7 +347,7 @@
    @ManagementProperty(description="the directory where temporary files will be stored",
          use={ViewUse.STATISTIC})
    @MetaMapping(FileMetaMapper.class)
-   public VirtualFile getServerTempDir()
+   public File getServerTempDir()
    {
       if (serverTempDir == null)
       {
@@ -362,13 +356,13 @@
          {
             try
             {
-               serverTempDir = VFS.getVirtualFile(getServerHomeDir().toURL(), ServerConfig.SERVER_TEMP_DIR_SUFFIX);
+               serverTempDir = new File(getServerHomeDir(), ServerConfig.SERVER_TEMP_DIR_SUFFIX);
             }
             catch (Exception e)
             {
                throw new RuntimeException(e);
             }
-            System.setProperty(ServerConfig.SERVER_TEMP_DIR, toPathName(serverTempDir));
+            System.setProperty(ServerConfig.SERVER_TEMP_DIR, serverTempDir.toString());
          }
       }
       return serverTempDir;
@@ -382,7 +376,7 @@
    @ManagementProperty(description="the directory where local data will be stored",
          use={ViewUse.STATISTIC})
    @MetaMapping(FileMetaMapper.class)
-   public VirtualFile getServerDataDir()
+   public File getServerDataDir()
    {
       if (serverDataDir == null)
       {
@@ -391,13 +385,13 @@
          {
             try
             {
-               serverDataDir = VFS.getVirtualFile(getServerHomeDir().toURL(), ServerConfig.SERVER_DATA_DIR_SUFFIX);
+               serverDataDir = new File(getServerHomeDir(), ServerConfig.SERVER_DATA_DIR_SUFFIX);
             }
             catch (Exception e)
             {
                throw new RuntimeException(e);
             }
-            System.setProperty(ServerConfig.SERVER_DATA_DIR, toPathName(serverDataDir));
+            System.setProperty(ServerConfig.SERVER_DATA_DIR, serverDataDir.toString());
          }
       }
       return serverDataDir;
@@ -411,17 +405,16 @@
    @ManagementProperty(description="the directory for platform native files",
          use={ViewUse.STATISTIC})
    @MetaMapping(FileMetaMapper.class)
-   public VirtualFile getServerNativeDir()
+   public File getServerNativeDir()
    {
       try
       {
          String fileName = this.getNativeDirProperty();
          if (fileName != null)
          {
-            URL url = new URL(fileName);
-            return VFS.getRoot(url);
+            return new File(fileName);
          }
-         return VFS.getVirtualFile(getServerTempDir().toURL(), "native");
+         return new File(getServerTempDir(), "native");
       }
       catch (Exception e)
       {
@@ -451,11 +444,11 @@
    @ManagementProperty(description="the temporary deployment dir",
          use={ViewUse.STATISTIC})
    @MetaMapping(FileMetaMapper.class)
-   public VirtualFile getServerTempDeployDir()
+   public File getServerTempDeployDir()
    {
       try
       {
-         return VFS.getVirtualFile(getServerTempDir().toURL(), "deploy");
+         return new File(getServerTempDir(), "deploy");
       }
       catch (Exception e)
       {
@@ -808,7 +801,7 @@
     * Get a File from configuration.
     * @return the CanonicalFile form for the given name.
     */
-   private VirtualFile getFile(final String name)
+   private File getFile(final String name)
    {
       String value = props.getProperty(name, null);
       if (value != null)
@@ -816,7 +809,15 @@
          try
          {
             URL url = new URL(value);
-            VirtualFile f = VFS.getRoot(url);
+            File f;
+            try
+            {
+               f = new File(url.toURI());
+            }
+            catch (URISyntaxException e)
+            {
+               throw new RuntimeException(e);
+            }
             return f;
          }
          catch (IOException e)
@@ -870,22 +871,4 @@
          return f;
       }
    }
-
-   private static String toPathName(VirtualFile virtualFile)
-   {
-      String path = null;
-      try
-      {
-         path = new File(VFSUtils.getRealURL(virtualFile).toURI()).getAbsolutePath();
-      }
-      catch (URISyntaxException e)
-      {
-         throw new RuntimeException(e);
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-      return path;
-   }
 }

Modified: projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/spi/ServerConfig.java
===================================================================
--- projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/spi/ServerConfig.java	2009-02-26 06:21:22 UTC (rev 84781)
+++ projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/spi/ServerConfig.java	2009-02-26 07:12:01 UTC (rev 84782)
@@ -21,9 +21,9 @@
  */
 package org.jboss.bootstrap.spi;
 
+import java.io.File;
 import java.net.URL;
 
-import org.jboss.virtual.VirtualFile;
 
 /**
  * The interface of the basic <em>typed</em> JBoss server configuration.
@@ -372,7 +372,7 @@
     *
     * @return    The local server home directory.
     */
-   VirtualFile getHomeDir();
+   File getHomeDir();
 
    /**
     * Get the home URL which the server is running from.
@@ -407,35 +407,35 @@
     *
     * @return    Base server home directory.
     */
-   VirtualFile getServerBaseDir();
+   File getServerBaseDir();
 
    /**
     * Get the server home directory.
     *
     * @return    Server home directory.
     */
-   VirtualFile getServerHomeDir();
+   File getServerHomeDir();
 
    /**
     * Get the directory where log files will be stored.
     *
     * @return    The directory where the server writes log files.
     */
-   VirtualFile getServerLogDir();
+   File getServerLogDir();
 
    /**
     * Get the directory where temporary files will be stored.
     *
     * @return    The directory where the server stores temporary files.
     */
-   VirtualFile getServerTempDir();
+   File getServerTempDir();
 
    /**
     * Get the directory where local data will be stored.
     *
     * @return    The directory where the server stores local data.
     */
-   VirtualFile getServerDataDir();
+   File getServerDataDir();
 
    /**
     * Get the base directory for calculating server home URLs.
@@ -558,14 +558,14 @@
     * 
     * @return the directory
     */
-   VirtualFile getServerNativeDir();
+   File getServerNativeDir();
 
    /**
     * Get the temporary deployment dir for unpacking
     * 
     * @return the directory
     */   
-   VirtualFile getServerTempDeployDir();
+   File getServerTempDeployDir();
 
    /**
     * Get the server Specification-Version




More information about the jboss-cvs-commits mailing list