[jboss-svn-commits] JBL Code SVN: r14444 - in labs/jbossesb/trunk/product: services/jbossesb/src/main/resources and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Aug 22 07:33:28 EDT 2007


Author: kevin.conner at jboss.com
Date: 2007-08-22 07:33:27 -0400 (Wed, 22 Aug 2007)
New Revision: 14444

Added:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabase.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabaseMBean.java
Modified:
   labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-ds.xml
Log:
Wait for hypersonic database initialisation: JBESB-861

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabase.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabase.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabase.java	2007-08-22 11:33:27 UTC (rev 14444)
@@ -0,0 +1,814 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.internal.soa.esb.dependencies;
+
+import java.awt.HeadlessException;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.Statement;
+
+import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.system.server.ServerConfigLocator;
+
+/**
+ * Integration with <a href="http://sourceforge.net/projects/hsqldb">HSQLDB</a>
+ *
+ * @author <a href="mailto:rickard.oberg at telkel.com">Rickard �berg</a>
+ * @author <a href="mailto:Scott_Stark at displayscape.com">Scott Stark</a>.
+ * @author <a href="mailto:pf at iprobot.com">Peter Fagerlund</a>
+ * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @author <a href="mailto:vesco.claudio at previnet.it">Claudio Vesco</a>
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @author <a href="mailto:kevin.conner at jboss.org">Kevin Conner</a>
+ * @version $Revision$
+ */
+public class HypersonicDatabase extends ServiceMBeanSupport
+   implements HypersonicDatabaseMBean
+{
+   /** Default password: <code>empty string</code>. */
+   private static final String DEFAULT_PASSWORD = "";
+   
+   /** Default user: <code>sa</code>. */
+   private static final String DEFAULT_USER = "sa";
+   
+   /** JDBC Driver class: <code>org.hsqldb.jdbcDriver</code>. */   
+   private static final String JDBC_DRIVER_CLASS = "org.hsqldb.jdbcDriver";
+   
+   /** JDBC URL common prefix: <code>jdbc:hsqldb:</code>. */
+   private static final String JDBC_URL_PREFIX = "jdbc:hsqldb:";
+   
+   /** Default shutdown command for remote hypersonic: <code>SHUTDOWN COMPACT</code>. */
+   private static final String DEFAULT_REMOTE_SHUTDOWN_COMMAND = "SHUTDOWN COMPACT";
+   
+   /** Default shutdown command for in process persist hypersonic: <code>SHUTDOWN COMPACT</code>. */
+   private static final String DEFAULT_IN_PROCESS_SHUTDOWN_COMMAND = "SHUTDOWN COMPACT";
+   
+   /** Default shutdown command for in process only memory hypersonic: <code>SHUTDOWN IMMEDIATELY</code>. */
+   private static final String DEFAULT_IN_MEMORY_SHUTDOWN_COMMAND = "SHUTDOWN IMMEDIATELY";
+   
+   /** Default data subdir: <code>hypersonic</code>. */
+   private static final String HYPERSONIC_DATA_DIR = "hypersonic";
+   
+   /** Default port for remote hypersonic: <code>1701</code>. */
+   private static final int DEFAULT_PORT = 1701;
+   
+   /** Default address for remote hypersonic: <code>0.0.0.0</code>. */
+   private static final String DEFAULT_ADDRESS = "0.0.0.0";
+   
+   /** Default database name: <code>default</code>. */
+   private static final String DEFAULT_DATABASE_NAME = "default";
+   
+   /** Database name for memory-only hypersonic: <code>.</code>. */
+   private static final String IN_MEMORY_DATABASE = ".";
+   
+   /** Default database manager (UI) class: <code>org.hsqldb.util.DatabaseManagerSwing</code>. */
+   private static final String DEFAULT_DATABASE_MANAGER_CLASS = "org.hsqldb.util.DatabaseManagerSwing";
+   
+   /** Default server class for remote hypersonic: <code>org.hsqldb.Server</code>. */
+   private static final String DEFAULT_SERVER_CLASS = "org.hsqldb.Server";
+   
+   /** Default delay for remote hypersonic initialisation (ms): <code>5000</code>. */
+   private static final long DEFAULT_DELAY = 5000;
+
+   // Private Data --------------------------------------------------
+   
+   /** Full path to db/hypersonic. */
+   private File dbPath;
+
+   /** Database name. */
+   private String name = DEFAULT_DATABASE_NAME;
+
+   /** Default port. */
+   private int port = DEFAULT_PORT;
+
+   /** Default address. */
+   private String address = DEFAULT_ADDRESS;
+   
+   /** Default silent. */
+   private boolean silent = true;
+
+   /** Default trace. */
+   private boolean trace = false;
+
+   /** Default no_system_exit, new embedded support in 1.7 */
+   private boolean no_system_exit = true;
+   
+   /** Default persisted DB */
+   private boolean persist = true;
+
+   /** Shutdown command. */
+   private String shutdownCommand;
+   
+   /** In process/remote mode. */
+   private boolean inProcessMode = false;
+   
+   /** Database user. */
+   private String user = DEFAULT_USER;
+   
+   /** Database password. */
+   private String password = DEFAULT_PASSWORD;
+   
+   /** Database manager (UI) class. */
+   private String databaseManagerClass = DEFAULT_DATABASE_MANAGER_CLASS;
+   
+   /** Server class for remote hypersonic. */
+   private String serverClass = DEFAULT_SERVER_CLASS;
+   
+   /** Server thread delay for remote hypersonic. */
+   private long delay = DEFAULT_DELAY ;
+   
+   /** Server thread for remote hypersonic. */
+   private Thread serverThread;
+   
+   /** Hold a connection for in process hypersonic. */
+   private Connection connection;
+
+   // Constructors --------------------------------------------------
+   
+   /**
+    * Costructor, empty.
+    */
+   public HypersonicDatabase()
+   {
+      // empty
+   }
+
+   // Attributes ----------------------------------------------------
+   
+   /**
+    * Set the database name.
+    * 
+    * @jmx.managed-attribute
+    */
+   public void setDatabase(String name)
+   {
+      if (name == null)
+      {
+         name = DEFAULT_DATABASE_NAME;
+      }
+      this.name = name;
+   }
+
+   /**
+    * Get the database name.
+    * 
+    * @jmx.managed-attribute
+    */
+   public String getDatabase()
+   {
+      return name;
+   }
+
+   /**
+    * Set the port for remote hypersonic.
+    * 
+    * @jmx.managed-attribute
+    */
+   public void setPort(final int port)
+   {
+      this.port = port;
+   }
+
+   /**
+    * Get the port for remote hypersonic.
+    * 
+    * @jmx.managed-attribute
+    */
+   public int getPort()
+   {
+      return port;
+   }
+
+   /**
+    * Set the bind address for remote hypersonic.
+    * 
+    * @jmx.managed-attribute
+    */
+   public void setBindAddress(final String address)
+   {
+      this.address = address;
+   }
+   
+   /**
+    * Get the bind address for remote hypersonic.
+    * 
+    * @jmx.managed-attribute
+    */
+   public String getBindAddress()
+   {
+      return address;
+   }
+   
+   /**
+    * Set silent flag.
+    * 
+    * @jmx.managed-attribute
+    */
+   public void setSilent(final boolean silent)
+   {
+      this.silent = silent;
+   }
+
+   /**
+    * Get silent flag.
+    * 
+    * @jmx.managed-attribute
+    */
+   public boolean getSilent()
+   {
+      return silent;
+   }
+
+   /**
+    * Set trace flag.
+    * 
+    * @jmx.managed-attribute
+    */
+   public void setTrace(final boolean trace)
+   {
+      this.trace = trace;
+   }
+
+   /**
+    * Get trace flag.
+    * 
+    * @jmx.managed-attribute
+    */
+   public boolean getTrace()
+   {
+      return trace;
+   }
+
+   /**
+    * If <b>true</b> the server thread for remote hypersonic does no call <code>System.exit()</code>.
+    * 
+    * @jmx.managed-attribute
+    */
+   public void setNo_system_exit(final boolean no_system_exit)
+   {
+      this.no_system_exit = no_system_exit;
+   }
+
+   /**
+    * Get the <code>no_system_exit</code> flag.
+    * 
+    * @jmx.managed-attribute
+    */
+   public boolean getNo_system_exit()
+   {
+      return no_system_exit;
+   }
+
+   /**
+    * Set persist flag.
+    * 
+    * @deprecated use {@link #setInProcessMode(boolean)(boolean) inProcessMode}.
+    * 
+    * @jmx.managed-attribute
+    */
+   public void setPersist(final boolean persist)
+   {
+      this.persist = persist;
+   }
+
+   /**
+    * Get persist flag.
+    * 
+    * @deprecated use {@link #setInProcessMode(boolean)(boolean) inProcessMode}.
+    * 
+    * @jmx.managed-attribute
+    */
+   public boolean getPersist()
+   {
+      return persist;
+   }
+
+   /**
+    * Get the full database path.
+    * 
+    * @jmx.managed-attribute
+    */
+   public String getDatabasePath()
+   {
+      if (dbPath != null)
+      {
+         return dbPath.toString();
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+   /**
+    * @return the <code>inProcessMode</code> flag.
+    * 
+    * @jmx.managed-attribute 
+    */
+   public boolean isInProcessMode()
+   {
+      return inProcessMode;
+   }
+
+   /**
+    * @return the shutdown command.
+    * 
+    * @jmx.managed-attribute
+    */
+   public String getShutdownCommand()
+   {
+      return shutdownCommand;
+   }
+
+   /**
+    * If <b>true</b> the hypersonic is in process mode otherwise hypersonic is in server or remote mode.
+    * 
+    * @param b in process mode or remote mode.
+    * 
+    * @jmx.managed-attribute
+    */
+   public void setInProcessMode(boolean b)
+   {
+      inProcessMode = b;
+   }
+
+   /**
+    * @param string the shutdown command
+    * 
+    * @jmx.managed-attribute 
+    */
+   public void setShutdownCommand(String string)
+   {
+      shutdownCommand = string;
+   }
+
+   /**
+    * @return the password
+    * 
+    * @jmx.managed-attribute 
+    */
+   public String getPassword()
+   {
+      return password;
+   }
+
+   /**
+    * @return the user
+    * 
+    * @jmx.managed-attribute 
+    */
+   public String getUser()
+   {
+      return user;
+   }
+
+   /**
+    * @param password
+    * 
+    * @jmx.managed-attribute 
+    */
+   public void setPassword(String password)
+   {
+      if (password == null)
+      {
+         password = DEFAULT_PASSWORD;
+      }
+      this.password = password;
+   }
+
+   /**
+    * @param user
+    * 
+    * @jmx.managed-attribute 
+    */
+   public void setUser(String user)
+   {
+      if (user == null)
+      {
+         user = DEFAULT_USER;
+      }
+      this.user = user;
+   }
+
+   /**
+    * @return
+    * 
+    * @jmx.managed-attribute 
+    */
+   public String getDatabaseManagerClass()
+   {
+      return databaseManagerClass;
+   }
+
+   /**
+    * Set the database manager (UI) class.
+    * 
+    * @param databaseManagerClass
+    * 
+    * @jmx.managed-attribute 
+    */
+   public void setDatabaseManagerClass(String databaseManagerClass)
+   {
+      if (databaseManagerClass == null)
+      {
+         databaseManagerClass = DEFAULT_DATABASE_MANAGER_CLASS;
+      }
+      this.databaseManagerClass = databaseManagerClass;
+   }
+
+   /**
+    * @return server class for remote hypersonic.
+    */
+   public String getServerClass()
+   {
+      return serverClass;
+   }
+
+   /**
+    * Set the server class for remote hypersonic.
+    * 
+    * @param serverClass
+    */
+   public void setServerClass(String serverClass)
+   {
+      if (serverClass == null)
+      {
+         serverClass = DEFAULT_SERVER_CLASS;
+      }
+      this.serverClass = serverClass;
+   }
+
+   /**
+    * Set the delay for remote hypersonic initialisation.
+    * 
+    * @jmx.managed-attribute
+    */
+   public void setDelay(final long delay)
+   {
+      this.delay = delay;
+   }
+
+   /**
+    * Get the delay for remote hypersonic initialisation.
+    * 
+    * @jmx.managed-attribute
+    */
+   public long getDelay()
+   {
+      return delay;
+   }
+
+   // Operations ----------------------------------------------------
+   
+   /** 
+    * Start of DatabaseManager accesible from the management console.
+    *
+    * @jmx.managed-operation
+    */
+   public void startDatabaseManager()
+   {
+      // Start DBManager in new thread
+      new Thread()
+      {
+         public void run()
+         {
+            try
+            {
+               // If bind address is the default 0.0.0.0, use localhost
+               String connectHost = DEFAULT_ADDRESS.equals(address) ? "localhost" : address;               
+               String driver = JDBC_DRIVER_CLASS;
+               String[] args;
+               if (!inProcessMode)
+               {
+                  args =
+                     new String[] {
+                        "-noexit",
+                        "-driver", driver,
+                        "-url", JDBC_URL_PREFIX + "hsql://" + connectHost + ":" + port,
+                        "-user", user,
+                        "-password", password,
+                        "-dir", getDatabasePath()
+                        };
+               }
+               else if (IN_MEMORY_DATABASE.equals(name))
+               {
+                  args =
+                     new String[] {
+                        "-noexit",
+                        "-driver", driver,
+                        "-url", JDBC_URL_PREFIX + IN_MEMORY_DATABASE,
+                        "-user", user,
+                        "-password", password
+                        };
+               }
+               else
+               {
+                  args =
+                     new String[] {
+                        "-noexit",
+                        "-driver", driver,
+                        "-url", JDBC_URL_PREFIX + getDatabasePath(),
+                        "-user", user,
+                        "-password", password,
+                        "-dir", getDatabasePath()
+                        };
+               }
+
+               // load (and link) the class only if needed
+               ClassLoader cl = Thread.currentThread().getContextClassLoader();
+               Class clazz = Class.forName(databaseManagerClass, true, cl);
+               Method main = clazz.getMethod("main", new Class[] { args.getClass() });
+               main.invoke(null, new Object [] { args });
+            }
+            catch (HeadlessException e)
+            {
+               log.error("Failed to start database manager because this is an headless configuration (no display, mouse or keyword)");
+            }
+            catch (Exception e)
+            {
+               log.error("Failed to start database manager", e);
+            }
+         }
+      }
+      .start();
+   }
+
+   // Lifecycle -----------------------------------------------------
+   
+   /**
+    * Start the database
+    */
+   protected void startService() throws Exception
+   {
+      // check persist for old compatibility
+      if (!persist)
+      {
+         inProcessMode = true;
+         name = IN_MEMORY_DATABASE;
+      }
+      
+      // which database?
+      if (!inProcessMode)
+      {
+         startRemoteDatabase();
+      }
+      else if (IN_MEMORY_DATABASE.equals(name))
+      {
+         startInMemoryDatabase();
+      }
+      else
+      {
+         startStandaloneDatabase();
+      }
+   }
+
+   /**
+    * We now close the connection clean by calling the
+    * serverSocket throught jdbc. The MBeanServer calls this 
+    * method at closing time.
+    */
+   protected void stopService() throws Exception
+   {
+      // which database?
+      if (!inProcessMode)
+      {
+         stopRemoteDatabase();
+      }
+      else if (IN_MEMORY_DATABASE.equals(name))
+      {
+         stopInMemoryDatabase();
+      }
+      else
+      {
+         stopStandaloneDatabase();
+      }
+   }
+   
+   // Private -------------------------------------------------------
+   
+   /**
+    * Start the standalone (in process) database.
+    */
+   private void startStandaloneDatabase() throws Exception
+   {
+      // Get the server data directory
+      File dataDir = ServerConfigLocator.locate().getServerDataDir();
+
+      // Get DB directory
+      File hypersoniDir = new File(dataDir, HYPERSONIC_DATA_DIR);
+
+      if (!hypersoniDir.exists())
+      {
+         hypersoniDir.mkdirs();
+      }
+
+      if (!hypersoniDir.isDirectory())
+      {
+         throw new IOException("Failed to create directory: " + hypersoniDir);
+      }
+      
+      dbPath = new File(hypersoniDir, name);
+
+      String dbURL = JDBC_URL_PREFIX + getDatabasePath();
+
+      // hold a connection so hypersonic does not close the database
+      connection = getConnection(dbURL);
+   }
+
+   /**
+    * Start the only in memory database.
+    */
+   private void startInMemoryDatabase() throws Exception
+   {
+      String dbURL = JDBC_URL_PREFIX + IN_MEMORY_DATABASE;
+
+      // hold a connection so hypersonic does not close the database
+      connection = getConnection(dbURL);
+   }
+
+   /**
+    * Start the remote database.
+    */
+   private void startRemoteDatabase() throws Exception
+   {
+      // Get the server data directory
+      File dataDir = ServerConfigLocator.locate().getServerDataDir();
+
+      // Get DB directory
+      File hypersoniDir = new File(dataDir, HYPERSONIC_DATA_DIR);
+
+      if (!hypersoniDir.exists())
+      {
+         hypersoniDir.mkdirs();
+      }
+
+      if (!hypersoniDir.isDirectory())
+      {
+         throw new IOException("Failed to create directory: " + hypersoniDir);
+      }
+      
+      dbPath = new File(hypersoniDir, name);
+
+      // Start DB in new thread, or else it will block us
+      serverThread = new Thread("hypersonic-" + name)
+      {
+         public void run()
+         {
+            try
+            {
+               // Create startup arguments
+               String[] args =
+                  new String[] {
+                     "-database", dbPath.toString(),
+                     "-port", String.valueOf(port),
+                     "-address", address,
+                     "-silent", String.valueOf(silent),
+                     "-trace", String.valueOf(trace),
+                     "-no_system_exit", String.valueOf(no_system_exit),
+                     };
+
+               // Start server
+               ClassLoader cl = Thread.currentThread().getContextClassLoader();
+               Class clazz = Class.forName(serverClass, true, cl);
+               Method main = clazz.getMethod("main", new Class[] { args.getClass() });
+               main.invoke(null, new Object[] { args } );
+            }
+            catch (Exception e)
+            {
+               log.error("Failed to start database", e);
+            }
+         }
+      };
+      serverThread.start();
+      
+      if (delay > 0)
+      {
+          log.debug("Waiting for Database initialisation: maximum " + delay + " milliseconds") ;
+          try
+          {
+              serverThread.join(delay) ;
+          }
+          catch (final InterruptedException ie)
+          {
+              Thread.currentThread().interrupt() ;
+          }
+          
+          if (serverThread.isAlive())
+          {
+              log.warn("Database initialisation is still active") ;
+          }
+          else
+          {
+              log.debug("Database initialisation completed") ;
+          }
+      }
+   }
+
+   /**
+    * Stop the standalone (in process) database.
+    */
+   private void stopStandaloneDatabase() throws Exception
+   {
+      String dbURL = JDBC_URL_PREFIX + getDatabasePath();
+
+      Connection connection = getConnection(dbURL);
+      Statement statement = connection.createStatement();
+      
+      String shutdownCommand = this.shutdownCommand;
+      if (shutdownCommand == null)
+      {
+         shutdownCommand = DEFAULT_IN_PROCESS_SHUTDOWN_COMMAND;
+      }
+      
+      statement.executeQuery(shutdownCommand);
+      this.connection = null;
+      log.info("Database standalone closed clean");
+   }
+
+   /**
+    * Stop the in memory database.
+    */
+   private void stopInMemoryDatabase() throws Exception
+   {
+      String dbURL = JDBC_URL_PREFIX + IN_MEMORY_DATABASE;
+
+      Connection connection = getConnection(dbURL);
+      Statement statement = connection.createStatement();
+      
+      String shutdownCommand = this.shutdownCommand;
+      if (shutdownCommand == null)
+      {
+         shutdownCommand = DEFAULT_IN_MEMORY_SHUTDOWN_COMMAND;
+      }
+      
+      statement.executeQuery(shutdownCommand);
+      this.connection = null;
+      log.info("Database in memory closed clean");
+   }
+
+   /**
+    * Stop the remote database.
+    */
+   private void stopRemoteDatabase() throws Exception
+   {
+      // If bind address is the default 0.0.0.0, use localhost
+      String connectHost = DEFAULT_ADDRESS.equals(address) ? "localhost" : address;
+      String dbURL = JDBC_URL_PREFIX + "hsql://" + connectHost + ":" + port;
+
+      Connection connection = getConnection(dbURL);
+      Statement statement = connection.createStatement();
+      
+      String shutdownCommand = this.shutdownCommand;
+      if (shutdownCommand == null)
+      {
+         shutdownCommand = DEFAULT_REMOTE_SHUTDOWN_COMMAND;
+      }
+      
+      statement.executeQuery(shutdownCommand);
+      // TODO: join thread?
+      serverThread = null;
+      this.connection = null;
+      log.info("Database remote closed clean");
+   }
+   
+   /**
+    * Get the connection.
+    * 
+    * @param dbURL jdbc url.
+    * @return the connection, allocate one if needed.
+    * @throws Exception
+    */
+   private synchronized Connection getConnection(String dbURL) throws Exception
+   {
+      if (connection == null)
+      {
+         ClassLoader cl = Thread.currentThread().getContextClassLoader();
+         Class.forName(JDBC_DRIVER_CLASS, true, cl).newInstance();
+         connection = DriverManager.getConnection(dbURL, user, password);
+      }
+      return connection;
+   }
+
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabase.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabaseMBean.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabaseMBean.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabaseMBean.java	2007-08-22 11:33:27 UTC (rev 14444)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.internal.soa.esb.dependencies;
+
+import javax.management.ObjectName;
+
+import org.jboss.mx.util.ObjectNameFactory;
+import org.jboss.system.ServiceMBean;
+
+/**
+ * MBean interface.
+ * 
+ * In all cases we run Hypersonic in the same VM with JBoss.
+ * A few notes on Hypersonic running modes:
+ * 
+ * remote (server) mode
+ *    hsqldb will listen for connections from local/remote clients
+ * 
+ * in-process (standalone) mode
+ *    hsqldb can only be contacted from in-vm clients
+ * 
+ * memory-only mode
+ *    hsqldb will only keep tables in memory, no persistence of data
+ * 
+ * @version $Revision$
+ */
+public interface HypersonicDatabaseMBean extends ServiceMBean
+{
+   /** The default ObjectName */
+   ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss:service=Hypersonic");
+
+   // Attributes ----------------------------------------------------
+
+   /** The silent flag, default is 'true' */
+   boolean getSilent();
+   void setSilent(boolean silent);
+
+   /** The trace flag, default is 'false' */
+   boolean getTrace();
+   void setTrace(boolean trace);
+   
+   /** The database name, default is 'default' */
+   String getDatabase();   
+   void setDatabase(String name);
+
+   /** The listening port when in remove server mode, default is '1701' */
+   int getPort();
+   void setPort(int port);
+
+   /** The binding address, default is '0.0.0.0' */
+   String getBindAddress();
+   void setBindAddress(String address);
+   
+   /** Whether remote server mode hypersonic should avoid calling System.exit() on shutdown, default is 'true'
+       By far, the worse mbean attribute name */
+   boolean getNo_system_exit();
+   void setNo_system_exit(boolean no_system_exit);
+
+   /** Whether DB is persisted, default is 'true'. A false value will activate memory only mode. */
+   boolean getPersist();
+   void setPersist(boolean persist);
+
+   /** Whether DB is in in-process mode or remote server mode, default is 'false' */
+   boolean isInProcessMode();
+   void setInProcessMode(boolean b);
+   
+   /** The default user to use when connecting to the DB, default is "sa" */
+   String getUser();   
+   void setUser(String user);
+   
+   /** The default password to use when connecting to the DB, default is "" */
+   String getPassword();
+   void setPassword(String password);
+   
+   /** The shutdown command to use when stopping the DB */
+   String getShutdownCommand();   
+   void setShutdownCommand(String string);
+
+   /** The database manager (UI) class, default is 'org.hsqldb.util.DatabaseManagerSwing' */
+   String getDatabaseManagerClass();
+   void setDatabaseManagerClass(String databaseManagerClass);
+   
+   /** The full database path */
+   String getDatabasePath();
+
+   /** The delay for initialisation of the remote hypersonic database, default is '5000'ms */
+   long getDelay();
+   void setDelay(long delay);
+
+   // Operations ----------------------------------------------------
+   
+   /**
+    * Start DatabaseManager accessible from the management console.
+    */
+   void startDatabaseManager();
+
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabaseMBean.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Modified: labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-ds.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-ds.xml	2007-08-22 11:03:04 UTC (rev 14443)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/resources/message-store-ds.xml	2007-08-22 11:33:27 UTC (rev 14444)
@@ -29,7 +29,7 @@
    </mbean>
    -->
    <!-- use for server mode (over tcp) -->
-   <mbean code="org.jboss.jdbc.HypersonicDatabase" 
+   <mbean code="org.jboss.internal.soa.esb.dependencies.HypersonicDatabase" 
      name="jboss:service=Hypersonic,database=jbossesb">
      <attribute name="Port">9001</attribute>
      <attribute name="BindAddress">${jboss.bind.address}</attribute>     




More information about the jboss-svn-commits mailing list