Examples of MConnector


Examples of org.apache.sqoop.model.MConnector

          restoreForms((JSONArray) jobJson.get(entry.getKey()));

        jobs.add(new MJobForms(type, jobForms));
      }

      MConnector connector = new MConnector(uniqueName, className, version, new MConnectionForms(connForms), jobs);
      connector.setPersistenceId(connectorId);

      connectors.add(connector);
    }

    if(jsonObject.containsKey(CONNECTOR_RESOURCES)) {
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

    );

  }

  protected MConnector getConnector() {
    return new MConnector("A", "org.apache.sqoop.test.A", "1.0-test",
      getConnectionForms(), getJobForms());
  }
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

    return (MConnector) doWithConnection(new DoWithConnection() {
      @Override
      public Object doIt(Connection conn) throws Exception {
        String connectorUniqueName = mConnector.getUniqueName();

        MConnector result = handler.findConnector(connectorUniqueName, conn);
        if (result == null) {
          handler.registerConnector(mConnector, conn);
          return mConnector;
        } else {
          if (!result.equals(mConnector)) {
            throw new SqoopException(RepositoryError.JDBCREPO_0013,
              "Connector: " + mConnector.getUniqueName()
              + " given: " + mConnector
              + " found: " + result);
          }
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

    // Load connector into repository
    loadConnectorAndFramework();

    // Retrieve it
    MConnector connector = handler.findConnector("A", getDerbyConnection());
    assertNotNull(connector);

    // Get original structure
    MConnector original = getConnector();

    // And compare them
    assertEquals(original, connector);
  }
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

    // And compare them
    assertEquals(original, connector);
  }

  public void testRegisterConnector() throws Exception {
    MConnector connector = getConnector();

    handler.registerConnector(connector, getDerbyConnection());

    // Connector should get persistence ID
    assertEquals(1, connector.getPersistenceId());

    // Now check content in corresponding tables
    assertCountForTable("SQOOP.SQ_CONNECTOR", 1);
    assertCountForTable("SQOOP.SQ_FORM", 6);
    assertCountForTable("SQOOP.SQ_INPUT", 12);

    // Registered connector should be easily recovered back
    MConnector retrieved = handler.findConnector("A", getDerbyConnection());
    assertNotNull(retrieved);
    assertEquals(connector, retrieved);
  }
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

  @Override
  public MConnector findConnector(String shortName, Connection conn) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Looking up connector: " + shortName);
    }
    MConnector mc = null;
    PreparedStatement baseConnectorFetchStmt = null;
    PreparedStatement formFetchStmt = null;
    PreparedStatement inputFetchStmt = null;
    try {
      baseConnectorFetchStmt = conn.prepareStatement(STMT_FETCH_BASE_CONNECTOR);
      baseConnectorFetchStmt.setString(1, shortName);
      ResultSet rsetBaseConnector = baseConnectorFetchStmt.executeQuery();

      if (!rsetBaseConnector.next()) {
        LOG.debug("No connector found by name: " + shortName);
        return null;
      }

      long connectorId = rsetBaseConnector.getLong(1);
      String connectorName = rsetBaseConnector.getString(2);
      String connectorClassName = rsetBaseConnector.getString(3);
      String connectorVersion = rsetBaseConnector.getString(4);

      formFetchStmt = conn.prepareStatement(STMT_FETCH_FORM_CONNECTOR);
      formFetchStmt.setLong(1, connectorId);
      inputFetchStmt = conn.prepareStatement(STMT_FETCH_INPUT);

      List<MForm> connectionForms = new ArrayList<MForm>();
      Map<MJob.Type, List<MForm>> jobForms =
        new HashMap<MJob.Type, List<MForm>>();

      loadForms(connectionForms, jobForms, formFetchStmt, inputFetchStmt, 1);

      mc = new MConnector(connectorName, connectorClassName, connectorVersion,
        new MConnectionForms(connectionForms),
        convertToJobList(jobForms));
      mc.setPersistenceId(connectorId);

      if (rsetBaseConnector.next()) {
        throw new SqoopException(DerbyRepoError.DERBYREPO_0005, shortName);
      }
    } catch (SQLException ex) {
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

      displayConnector(connector);
    }
  }

  private void showConnector(Long cid) {
    MConnector connector = client.getConnector(cid);

    printlnResource(Constants.RES_SHOW_PROMPT_CONNECTORS_TO_SHOW, 1);

    displayConnector(connector);
  }
View Full Code Here
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.