Package com.dp.nebula.wormhole.common.interfaces

Examples of com.dp.nebula.wormhole.common.interfaces.IParam


    readerJobConf.setPluginName(readerName);
    readerJobConf.setId(readerId == null ? "reader-id-" + readerName
        : readerId.trim());
    Map<String, String> readerPluginParamMap = getParamMap(readerE);

    IParam readerPluginParam = new DefaultParam(readerPluginParamMap);
    readerJobConf.setPluginParam(readerPluginParam);

    List<JobPluginConf> writerJobConfs = new ArrayList<JobPluginConf>();
    List<Element> writerEs = (List<Element>) document.selectNodes(xpath
        + "/writer");

    for (Element writerE : writerEs) {
      JobPluginConf writerPluginConf = new JobPluginConf();

      Element writerPluginE = (Element) writerE
          .selectSingleNode("plugin");
      String writerName = writerPluginE.getStringValue().trim()
          .toLowerCase();
      String writerId = writerE.attributeValue("id");
      writerPluginConf.setPluginName(writerName);
      writerPluginConf.setId(writerId == null ? "writer-id-"
          + writerEs.indexOf(writerE) + "-" + writerName : writerId
          .trim());

      Map<String, String> writerPluginParamMap = getParamMap(writerE);

      IParam writerPluginParam = new DefaultParam(writerPluginParamMap);

      writerPluginConf.setPluginParam(writerPluginParam);
      writerJobConfs.add(writerPluginConf);
    }
View Full Code Here


    List<Element> pluginsEs = (List<Element>) doc.selectNodes(xpath);
    for (Element pluginsE : pluginsEs) {
      Map<String, String> pluginParamsMap = getParamMap(pluginsE);

      if (pluginParamsMap.containsKey("name")) {
        IParam plugin = new DefaultParam(pluginParamsMap);
        pluginsMap.put(pluginParamsMap.get("name"), plugin);
      } else {
        LOG.error(String
            .format("WormHole plugin configure file can't find xpath \"%s\" plugin name",
                pluginsE.getPath()));
View Full Code Here

   
    Map<String, String> params = new HashMap<String, String>();
    params.put(ParamKey.url, "jdbc:hsqldb:mem:" + DB_NAME);
    params.put(ParamKey.username, "sa");
    params.put(ParamKey.sql, "SELECT str_col, num_col FROM sample_table WHERE num_col < 250");
    IParam iParam = new DefaultParam(params);
   
   
    periphery.prepare(iParam, null);
    splitter.init(iParam);
    splitter.split();
View Full Code Here

import com.dp.nebula.wormhole.engine.storage.StorageConf;
import com.dp.nebula.wormhole.engine.storage.StorageManager;

public class BufferedLineExchangerTest {
  public static BufferedLineExchanger getLineExchanger(){
    IParam engineConf = null;
    engineConf = ParseXMLUtil.loadEngineConfig();
    List<StorageConf> result = new ArrayList<StorageConf>();
   
    for(int i = 0; i< 5; i++){
      StorageConf storageConf = new StorageConf();
      storageConf.setId(String.valueOf(i));
      storageConf.setStorageClassName(
          engineConf.getValue(EngineConfParamKey.STORAGE_CLASS_NAME));
      storageConf.setLineLimit(
          10);
      storageConf.setByteLimit(
          engineConf.getIntValue(EngineConfParamKey.STORAGE_BYTE_LIMIT));
      storageConf.setDestructLimit(
          engineConf.getIntValue(EngineConfParamKey.STORAGE_DESTRUCT_LIMIT));
      storageConf.setPeriod(
          engineConf.getIntValue(EngineConfParamKey.MONITOR_INFO_DISPLAY_PERIOD));
      storageConf.setWaitTime(
          1000);
      result.add(storageConf);
    }
    StorageManager manager = new StorageManager(result);
View Full Code Here

        String file = p.toString() + "/" + prefix + "-" + i;
        if (!StringUtils.isEmpty(suffix)){
          file = file + "." + suffix;
        }
       
        IParam oParams = param.clone();
        oParams.putValue(ParamKey.dir, file);
        v.add(oParams);
      }
    }
    return v;
  }
View Full Code Here

import com.dp.nebula.wormhole.plugins.reader.greenplumreader.ParamKey;

public class GreenplumReaderTest {
 
  public static BufferedLineExchanger getLineExchanger(){
    IParam engineConf = null;
    engineConf = ParseXMLUtil.loadEngineConfig();
    List<StorageConf> result = new ArrayList<StorageConf>();
   
    for(int i = 0; i< 1; i++){
      StorageConf storageConf = new StorageConf();
      storageConf.setId(String.valueOf(i));
      storageConf.setStorageClassName(
          engineConf.getValue(EngineConfParamKey.STORAGE_CLASS_NAME));
      storageConf.setLineLimit(
          10);
      storageConf.setByteLimit(
          engineConf.getIntValue(EngineConfParamKey.STORAGE_BYTE_LIMIT));
      storageConf.setDestructLimit(
          engineConf.getIntValue(EngineConfParamKey.STORAGE_DESTRUCT_LIMIT));
      storageConf.setPeriod(
          engineConf.getIntValue(EngineConfParamKey.MONITOR_INFO_DISPLAY_PERIOD));
      storageConf.setWaitTime(
          5000
         
      );
      result.add(storageConf);
View Full Code Here

    params.put(ParamKey.dbname, "dianpingdw");
    params.put(ParamKey.username, "tempuser_201302211841");
    params.put(ParamKey.password,"dp!@g0Y8bRfvL");

    params.put(ParamKey.sql, "copy (select * from dpmid.mid_dp_shop_info_his where cal_dt = '2012-01-01' limit 20) to stdout WITH DELIMITER E'\t' ");
    IParam iParam = new DefaultParam(params);
   
    gpPeriphery.prepare(iParam,null);
    gpReader.setParam(iParam);
    BufferedLineExchanger bufLineExchanger = getLineExchanger();
   
View Full Code Here

     
    MongoReader mongoReader = new MongoReader();
    Map<String, String> params = new HashMap<String, String>();
    params.put(ParamKey.inputUri, "mongodb://localhost:" + MONGODB_PORT + "/embedded.testCollection");
    params.put(ParamKey.inputFields, "{ msg : 1 }");
    IParam iParam = new DefaultParam(params);
    mongoReader.setParam(iParam);
    BufferedLineExchanger bufLineExchanger = HiveReaderTest.getBufferedLineExchangerInstance();
   
    IPluginMonitor pluginMonitor = mock(IPluginMonitor.class);
    mongoReader.setMonitor(pluginMonitor);
View Full Code Here

    int concurrency = param.getIntValue(ParamKey.concurrency, 1);
    Preconditions.checkArgument((concurrency > 0 && concurrency <= 10),
        "illegal concurrency number argument " + concurrency);
   
    for (int i = 0; i < concurrency; i++) {
      IParam iParam = param.clone();
      result.add(iParam);
    }
    LOG.info("the number of split: " + result.size());
    return result;
  }
View Full Code Here

    log.info( "Calculated " + splits.size() + " split objects." );
    return splits;
  }
 
  private IParam createParamSplit(IParam param, DBObject q, DBObject min, DBObject max) {
    IParam p = param.clone();
    BasicDBObjectBuilder b = BasicDBObjectBuilder.start("$query", q);
   
    // The min() value is included in the range and the max() value is excluded.
    if (null != min) {
      b.append("$min", min);
    }
    if (null != max) {
      b.append("$max", max);
    }
   
    final DBObject query = b.get();
        log.debug( "Assembled Query: " + query );
       
        p.putValue(ParamKey.inputQuery, JSON.serialize(query));
    return p;
  }
View Full Code Here

TOP

Related Classes of com.dp.nebula.wormhole.common.interfaces.IParam

Copyright © 2018 www.massapicom. 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.