User: user57  
  Date: 02/02/12 20:26:39

  Modified:    varia/src/main/org/jboss/jdbc HypersonicDatabase.java
  Log:
   o These are all kinda related, so I am commiting them together
   o This is the second half of the migration to using ObjectName OBJECT_NAME
   o Not using jboss.system.* properties anywhere (one place in testsuite
     which I am ignoring for now)
   o StateManager will now read its config from a url (configURL), and only
     attempt to write it back out if that is a file URL.  Need to fix this
     to not need to write back to a config file.
   o Still setting jboss.home & jboss.system.home, but use ServerConfigMBean
     to get the proper bits, will eventually abstract all file access out
   o Added a simple locator to find a mbean server.  This is trivial code,
     but helps clean up client code and makes it obvious what it does.
  
  Revision  Changes    Path
  1.12      +21 -30    contrib/varia/src/main/org/jboss/jdbc/HypersonicDatabase.java
  
  Index: HypersonicDatabase.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/varia/src/main/org/jboss/jdbc/HypersonicDatabase.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- HypersonicDatabase.java   7 Feb 2002 02:19:19 -0000       1.11
  +++ HypersonicDatabase.java   13 Feb 2002 04:26:39 -0000      1.12
  @@ -14,8 +14,8 @@
   import java.sql.Statement;
   import javax.management.*;
   
  -import org.jboss.util.DirectoryBuilder;
   import org.jboss.system.ServiceMBeanSupport;
  +import org.jboss.system.ServerConfigMBean;
   import org.jboss.logging.Logger;
   
   // our patched HSQLDB Server class
  @@ -23,16 +23,17 @@
   import org.hsqldb.util.Embedded_DatabaseManager;
   
   /**
  - * Integration with Hypersonic SQL (c). 
  - * Starts a "patched" HSQLDB 1.61 Hypersonic database in-VM.
  - * http://sourceforge.net/projects/hsqldb/
  + * Integration with <a href="http://sourceforge.net/projects/hsqldb";>Hypersonic 
SQL</a> (c).
  + * 
  + * <p>Starts a "patched" HSQLDB 1.61 Hypersonic database in-VM.
    * 
    * @see HypersonicDatabaseMBean
  + * 
    * @author <a href="mailto:[EMAIL PROTECTED]";>Rickard Öberg</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>.
    * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Fagerlund</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
  - * @version $Revision: 1.11 $
  + * @version $Revision: 1.12 $
    */
   public class HypersonicDatabase 
      extends ServiceMBeanSupport 
  @@ -41,7 +42,7 @@
      /** HSQLDB patched server class. */
      org.hsqldb.Embedded_Server embeddedDBServer;
   
  -   /** Full path to db. */
  +   /** Full path to db/hypersonic. */
      File dbPath;
   
      /** Database name will be appended to <em>jbossHome/db/hypersonic</em>. */
  @@ -92,26 +93,14 @@
         return trace;
      }
   
  -   public String getName() {
  -      return "Hypersonic";
  -   }
  -
      public String getDatabasePath() {
         return dbPath.toString();
      }
   
  -   public ObjectName getObjectName(MBeanServer server, 
  -                                ObjectName name)
  +   protected ObjectName getObjectName(MBeanServer server, ObjectName name)
         throws MalformedObjectNameException 
      {
  -      return name == null ? new ObjectName(OBJECT_NAME) : name;
  -   }
  -
  -   public ObjectName preRegister(MBeanServer server, 
  -                              ObjectName name)
  -      throws Exception 
  -   {
  -      return getObjectName(server, name);
  +      return name == null ? OBJECT_NAME : name;
      }
   
      /** 
  @@ -133,22 +122,24 @@
      }
   
      public void startService() throws Exception {
  +      // Get the server data directory
  +      File dataDir = (File)
  +         server.getAttribute(ServerConfigMBean.OBJECT_NAME, "DataDir");
  +      
         // Get DB directory
  -      log.warn("using jboss.system.home property");
  -      DirectoryBuilder dirb = 
  -      new DirectoryBuilder(System.getProperty("jboss.system.home"));
  -      dbPath = dirb.cd("db").cd("hypersonic").cd(name).get();
  -
  +      dbPath = new File(dataDir, "hypersonic");
  +      final File prefix = new File(dbPath, name);
  +      
         // Start DB in new thread, or else it will block us
  -      new Thread() {
  +      new Thread("hypersonic-" + name) {
         public void run() {
            try {
               // Create startup arguments
               String[] args = new String[] {
  -               "-database", dbPath.toString(), 
  -               "-port", port + "", 
  -               "-silent", silent + "", 
  -               "-trace", trace + ""
  +               "-database", prefix.toString(),
  +               "-port",     String.valueOf(port), 
  +               "-silent",   String.valueOf(silent), 
  +               "-trace",    String.valueOf(trace),
               };
               
               // Start server
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to