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.examples;
21  
22  import org.jumpmind.symmetric.SymmetricEngine;
23  
24  public class StartSymmetricEngine {
25  
26      /***
27       * Start an engine that is configured by two properties files. One is
28       * packaged with the application and contains overridden properties that are
29       * specific to the application. The other is found in the application's
30       * working directory. It can be used to setup environment specific
31       * properties.
32       */
33      public static void main(String[] args) throws Exception {
34          String workingDirectory = System.getProperty("user.dir");
35  
36          SymmetricEngine engine = new SymmetricEngine("classpath://my-symmetric-application.properties", "file://"
37                  + workingDirectory + "/my-symmetric-environment.properties");
38  
39          // this will create the database, sync triggers, start jobs running
40          engine.start();
41      }
42  
43  }