View Javadoc

1   /*
2    * SymmetricDS is an open source database synchronization solution.
3    *   
4    * Copyright (C) Chris Henson <chenson42@users.sourceforge.net>
5    *
6    * This library is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU Lesser General Public
8    * License as published by the Free Software Foundation; either
9    * version 3 of the License, or (at your option) any later version.
10   *
11   * This library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   * Lesser General Public License for more details.
15   *
16   * You should have received a copy of the GNU Lesser General Public
17   * License along with this library; if not, see
18   * <http://www.gnu.org/licenses/>.
19   */
20  package org.jumpmind.symmetric.common;
21  
22  import java.util.HashSet;
23  import java.util.Set;
24  
25  public class TableConstants {
26  
27      public static final String SYM_TRIGGER = "trigger";
28      public static final String SYM_TRIGGER_HIST = "trigger_hist";
29      public static final String SYM_NODE = "node";
30      public static final String SYM_NODE_SECURITY = "node_security";
31      public static final String SYM_NODE_IDENTITY = "node_identity";
32      public static final String SYM_CHANNEL = "channel";
33      public static final String SYM_NODE_GROUP = "node_group";
34      public static final String SYM_NODE_GROUP_LINK = "node_group_link";
35  
36      public static String[] NODE_TABLES = { SYM_NODE, SYM_NODE_SECURITY, SYM_NODE_IDENTITY };
37  
38      public static final Set<String> getNodeTablesAsSet(String tablePrefix) {
39          Set<String> tables = new HashSet<String>();
40          tables.add(getTableName(tablePrefix, SYM_NODE));
41          tables.add(getTableName(tablePrefix, SYM_NODE_SECURITY));
42          tables.add(getTableName(tablePrefix, SYM_NODE_IDENTITY));
43          return tables;
44      }
45  
46      public static String getTableName(String tablePrefix, String tableSuffix) {
47          return String.format("%s_%s", tablePrefix, tableSuffix);
48      }
49  }