Package org.lilyproject.lilyservertestfw.launcher

Source Code of org.lilyproject.lilyservertestfw.launcher.HbaseIndexerLauncherService

package org.lilyproject.lilyservertestfw.launcher;

import java.io.File;
import java.util.List;

import com.ngdata.hbaseindexer.HBaseIndexerConfiguration;
import com.ngdata.hbaseindexer.Main;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.hadoop.conf.Configuration;
import org.lilyproject.indexer.hbase.mapper.LilyIndexerLifecycleEventListener;

public class HbaseIndexerLauncherService implements LauncherService {
    private Main hbaseIndexerService;
    private Configuration conf;

    @Override
    public void addOptions(List<Option> options) {
    }

    @Override
    public int setup(CommandLine cmd, File testHome, boolean clearData) throws Exception {
        hbaseIndexerService = new Main();
        conf = HBaseIndexerConfiguration.create();
        conf.set("hbaseindexer.lifecycle.listeners", LilyIndexerLifecycleEventListener.class.getName());
        return 0;
    }

    @Override
    public int start(List<String> postStartupInfo) throws Exception {
        if (hbaseIndexerService == null) {
            setup(null, null, false);
        }

        hbaseIndexerService.startServices(conf);
        return 0;
    }

    @Override
    public void stop() {
        if (hbaseIndexerService != null)
            hbaseIndexerService.stopServices();
    }

    public Main getHbaseIndexerService() {
        return hbaseIndexerService;
    }
}
TOP

Related Classes of org.lilyproject.lilyservertestfw.launcher.HbaseIndexerLauncherService

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.