Review Board 1.7.22


SQOOP-850 Sqoop2: Move server initialization from server module to core

Review Request #9071 - Created Jan. 23, 2013 and submitted

Jarek Cecho
SQOOP-850
Reviewers
Sqoop
sqoop-sqoop2
I've moved initialization and destroyer logic to newly created class SqoopServer.
Unit tests seems to be passing and I've run simple import on real cluster.

Diff revision 2 (Latest)

1 2
1 2

  1. core/src/main/java/org/apache/sqoop/core/SqoopServer.java: Loading...
  2. server/src/main/java/org/apache/sqoop/server/ServerInitializer.java: Loading...
core/src/main/java/org/apache/sqoop/core/SqoopServer.java
New File

    
   
1
/**

    
   
2
 * Licensed to the Apache Software Foundation (ASF) under one

    
   
3
 * or more contributor license agreements.  See the NOTICE file

    
   
4
 * distributed with this work for additional information

    
   
5
 * regarding copyright ownership.  The ASF licenses this file

    
   
6
 * to you under the Apache License, Version 2.0 (the

    
   
7
 * "License"); you may not use this file except in compliance

    
   
8
 * with the License.  You may obtain a copy of the License at

    
   
9
 *

    
   
10
 *     http://www.apache.org/licenses/LICENSE-2.0

    
   
11
 *

    
   
12
 * Unless required by applicable law or agreed to in writing, software

    
   
13
 * distributed under the License is distributed on an "AS IS" BASIS,

    
   
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

    
   
15
 * See the License for the specific language governing permissions and

    
   
16
 * limitations under the License.

    
   
17
 */

    
   
18
package org.apache.sqoop.core;

    
   
19

   

    
   
20
import org.apache.log4j.Logger;

    
   
21
import org.apache.sqoop.connector.ConnectorManager;

    
   
22
import org.apache.sqoop.framework.FrameworkManager;

    
   
23
import org.apache.sqoop.repository.RepositoryManager;

    
   
24

   

    
   
25
/**

    
   
26
 * Entry point for initializing and destroying Sqoop server

    
   
27
 */

    
   
28
public class SqoopServer {

    
   
29

   

    
   
30
  private static final Logger LOG = Logger.getLogger(SqoopServer.class);

    
   
31

   

    
   
32
  public static void destroy() {

    
   
33
    LOG.info("Shutting down Sqoop server");

    
   
34
    FrameworkManager.getInstance().destroy();

    
   
35
    ConnectorManager.getInstance().destroy();

    
   
36
    RepositoryManager.getInstance().destroy();

    
   
37
    SqoopConfiguration.getInstance().destroy();

    
   
38
    LOG.info("Sqoop server has been correctly terminated");

    
   
39
  }

    
   
40

   

    
   
41
  public static void initialize() {

    
   
42
    try {

    
   
43
      LOG.info("Booting up Sqoop server");

    
   
44
      SqoopConfiguration.getInstance().initialize();

    
   
45
      RepositoryManager.getInstance().initialize();

    
   
46
      ConnectorManager.getInstance().initialize();

    
   
47
      FrameworkManager.getInstance().initialize();

    
   
48
      LOG.info("Sqoop server has successfully boot up");

    
   
49
    } catch (Exception ex) {

    
   
50
      LOG.error("Server startup failure", ex);

    
   
51
      throw new RuntimeException("Failure in server initialization", ex);

    
   
52
    }

    
   
53
  }

    
   
54
}
server/src/main/java/org/apache/sqoop/server/ServerInitializer.java
Revision 5998e01e9b7388d561b16079dedbf9ab808aad85 New Change
 
  1. core/src/main/java/org/apache/sqoop/core/SqoopServer.java: Loading...
  2. server/src/main/java/org/apache/sqoop/server/ServerInitializer.java: Loading...