You might want to use the "local-directory" feature of jboss-service files.
 This copies a directory out of a sar into (as I recall) db.  There's a
test in one of the jmx tests.  I'm not sure if anyone checked that it
doesn't overwrite anything already there;-)

david jencks

On 2002.02.15 03:28:39 -0500 Jason Dillon wrote:
>   User: user57  
>   Date: 02/02/15 00:28:39
> 
>   Modified:    varia/src/main/org/jboss/jdbc HypersonicDatabase.java
>   Log:
>    o HypersonicDatabase will now create its directory under db/ when it
> is
>      no there.
>    o not creating db/hypersonic or db/jbossmq directories from build
> anymore
>    o scheme.ini take a hike, unless you can find me your owner
>   
>   Revision  Changes    Path
>   1.13      +17 -9     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.12
>   retrieving revision 1.13
>   diff -u -r1.12 -r1.13
>   --- HypersonicDatabase.java 13 Feb 2002 04:26:39
> -0000 1.12
>   +++ HypersonicDatabase.java 15 Feb 2002 08:28:38
> -0000 1.13
>   @@ -8,10 +8,13 @@
>    package org.jboss.jdbc;
>    
>    import java.io.File;
>   +import java.io.IOException;
>   +
>    import java.sql.Connection;
>    import java.sql.DriverManager;
>    import java.sql.SQLException;
>    import java.sql.Statement;
>   +
>    import javax.management.*;
>    
>    import org.jboss.system.ServiceMBeanSupport;
>   @@ -33,7 +36,7 @@
>     * @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.12 $
>   + * @version $Revision: 1.13 $
>     */
>    public class HypersonicDatabase 
>       extends ServiceMBeanSupport 
>   @@ -121,13 +124,20 @@
>          }.start();
>       }
>    
>   -   public void startService() throws Exception {
>   +   protected void startService() throws Exception {
>          // Get the server data directory
>          File dataDir = (File)
>             server.getAttribute(ServerConfigMBean.OBJECT_NAME,
> "DataDir");
>          
>          // Get DB directory
>          dbPath = new File(dataDir, "hypersonic");
>   +      if (!dbPath.exists()) {
>   +         dbPath.mkdirs();
>   +      }
>   +      if (!dbPath.isDirectory()) {
>   +         throw new IOException("Failed to create directory: " +
> dbPath);
>   +      }
>   +      
>          final File prefix = new File(dbPath, name);
>          
>          // Start DB in new thread, or else it will block us
>   @@ -160,7 +170,7 @@
>        *
>        * @author Peter Fagerlund [EMAIL PROTECTED] 
>        */
>   -   public void stopService() {
>   +   protected void stopService() throws Exception {
>          Connection connection;
>          Statement statement;
>          String cmd = "SHUTDOWN";
>   @@ -178,11 +188,9 @@
>        statement = connection.createStatement();
>        statement.executeQuery(cmd);
>        log.info("Database closed clean");
>   -      } 
>   -      catch (Exception e) {
>   -    log.error("Failed to shutdown database", e);
>   -      } 
>   -      
>   -      embeddedDBServer = null;
>   +      }
>   +      finally {
>   +         embeddedDBServer = null;
>   +      }
>       }
>    }
>   
>   
>   
> 
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-development
> 
> 

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

Reply via email to