MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdbBase.java
1 /* -*- mode: java; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=4:tabstop=4:smarttab:
3  *
4  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 package com.mysql.cluster.crund;
21 
22 abstract public class NdbBase extends CrundDriver {
23 
24  // NDB settings
25  protected String mgmdConnect;
26  protected String catalog;
27  protected String schema;
28 
29  // so far, there's no NDB support for caching data beyond Tx scope
30  protected void clearPersistenceContext() throws Exception {}
31 
32  // ----------------------------------------------------------------------
33  // NDB Base intializers/finalizers
34  // ----------------------------------------------------------------------
35 
36  protected void initProperties() {
37  super.initProperties();
38 
39  out.print("setting ndb properties ...");
40 
41  final StringBuilder msg = new StringBuilder();
42  final String eol = System.getProperty("line.separator");
43 
44  // the hostname and port number of NDB mgmd
45  mgmdConnect = props.getProperty("ndb.mgmdConnect", "localhost");
46  assert mgmdConnect != null;
47 
48  // the database
49  catalog = props.getProperty("ndb.catalog", "crunddb");
50  assert catalog != null;
51 
52  // the schema
53  schema = props.getProperty("ndb.schema", "def");
54  assert schema != null;
55 
56  if (msg.length() == 0) {
57  out.println(" [ok]");
58  } else {
59  out.println();
60  out.print(msg.toString());
61  }
62  }
63 
64  protected void printProperties() {
65  super.printProperties();
66 
67  out.println();
68  out.println("ndb settings ...");
69  out.println("ndb.mgmdConnect: \"" + mgmdConnect + "\"");
70  out.println("ndb.catalog: \"" + catalog + "\"");
71  out.println("ndb.schema: \"" + schema + "\"");
72  }
73 }