View Javadoc

    1   /**
    2    * Copyright (c) 2002-2011 "Neo Technology,"
    3    * Network Engine for Objects in Lund AB [http://neotechnology.com]
    4    *
    5    * This file is part of Neo4j.
    6    *
    7    * Neo4j is free software: you can redistribute it and/or modify
    8    * it under the terms of the GNU General Public License as published by
    9    * the Free Software Foundation, either version 3 of the License, or
    10   * (at your option) any later version.
    11   *
    12   * This program is distributed in the hope that it will be useful,
    13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    15   * GNU General Public License for more details.
    16   *
    17   * You should have received a copy of the GNU General Public License
    18   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    19   */
    20  package org.neo4j.server;
    21
    22  import java.util.Arrays;
    23  import java.util.Map;
    24
    25  import org.apache.commons.configuration.Configuration;
    26  import org.neo4j.kernel.AbstractGraphDatabase;
    27  import org.neo4j.kernel.EmbeddedGraphDatabase;
    28  import org.neo4j.server.database.GraphDatabaseFactory;
    29  import org.neo4j.server.modules.DiscoveryModule;
    30  import org.neo4j.server.modules.ManagementApiModule;
    31  import org.neo4j.server.modules.RESTApiModule;
    32  import org.neo4j.server.modules.ServerModule;
    33  import org.neo4j.server.modules.ThirdPartyJAXRSModule;
    34  import org.neo4j.server.modules.WebAdminModule;
    35  import org.neo4j.server.startup.healthcheck.ConfigFileMustBePresentRule;
    36  import org.neo4j.server.startup.healthcheck.Neo4jPropertiesMustExistRule;
    37  import org.neo4j.server.startup.healthcheck.StartupHealthCheckRule;
    38
    39  public class NeoServerBootstrapper extends Bootstrapper
    40  {
    41      @Override
    42      public Iterable<StartupHealthCheckRule> getHealthCheckRules()
    43      {
    44          return Arrays.asList( new ConfigFileMustBePresentRule(), new Neo4jPropertiesMustExistRule() );
    45      }
    46
    47      @Override
    48      @SuppressWarnings( "unchecked" )
    49      public Iterable<Class<? extends ServerModule>> getServerModules()
    50      {
    51          return Arrays.asList( DiscoveryModule.class, RESTApiModule.class, ManagementApiModule.class,
    52                  ThirdPartyJAXRSModule.class, WebAdminModule.class );
    53      }
    54
    55      @Override
    56      protected GraphDatabaseFactory getGraphDatabaseFactory( Configuration configuration )
    57      {
    58          return new GraphDatabaseFactory()
    59          {
    60              @Override
    61              public AbstractGraphDatabase createDatabase( String databaseStoreDirectory,
    62                      Map<String, String> databaseProperties )
    63              {
    64                  return new EmbeddedGraphDatabase( databaseStoreDirectory, databaseProperties );
    65              }
    66          };
    67      }
    68  }