/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.activemq.store.jdbc.adapter;

import org.apache.activemq.store.jdbc.Statements;

/**
 * 
 * @org.apache.xbean.XBean element="mysql-jdbc-adapter"
 * @version $Revision$
 */
public class MySqlJDBCAdapter extends DefaultJDBCAdapter {

    public void setStatements(Statements statements) {
        statements.setLockCreateStatement("LOCK TABLE " + statements.getFullLockTableName() + " WRITE");
        statements.setBinaryDataType("LONGBLOB");
        
        // Use INNODB table since we need transaction support.
        String[] s = statements.getCreateSchemaStatements();
        for (int i = 0; i < s.length; i++) {
            if( s[i].startsWith("CREATE TABLE")) {
                s[i] = s[i]+" TYPE=INNODB";
            }
        }
        
        super.setStatements(statements);
    }    
}

@@ -1056,59 +1056,706 @@
     
-public void setStatements(Statements statements) %7B%0A
+// The transactional types..%0A    public static final String INNODB = %22INNODB%22;%0A    public static final String NDBCLUSTER = %22NDBCLUSTER%22;%0A    public static final String BDB = %22BDB%22;%0A%0A    // The non transactional types..%0A    public static final String MYISAM = %22MYISAM%22;%0A    public static final String ISAM = %22ISAM%22;%0A    public static final String MERGE = %22MERGE%22;%0A    public static final String HEAP = %22HEAP%22;%0A%0A    String engineType = INNODB;%0A%0A    public void setStatements(Statements statements) %7B%0A        String type = engineType.toUpperCase();%0A        if( !type.equals(INNODB) &&  !type.equals(NDBCLUSTER) ) %7B%0A            // Don't use LOCK TABLE for the INNODB and NDBCLUSTER engine types...%0A    
     
@@ -1851,24 +1851,35 @@
  %22 WRITE%22);%0A
+        %7D%0A%0A
         stat
@@ -1941,58 +1941,73 @@
 // U
-se INNODB table since we need transaction support.
+pdate the create statements so they use the right type of engine 
 %0A   
@@ -2195,23 +2195,22 @@
 +%22 TYPE=
-INNODB%22
+%22+type
 ;%0A      
@@ -2227,25 +2227,16 @@
       %7D%0A
-        %0A
         
@@ -2273,15 +2273,177 @@
 );%0A    %7D
+%0A%0A
     
+public String getEngineType() %7B%0A        return engineType;%0A    %7D%0A%0A    public void setEngineType(String engineType) %7B%0A        this.engineType = engineType;%0A    %7D
 %0A%7D%0A

Support mysql cluster configurations