Package org.apache.sqoop.model

Examples of org.apache.sqoop.model.MConnectionForms


    Map<String, String> map = new HashMap<String, String>();
    map.put("A", "B");

    // Connection object with all various values
    MConnection connection = new MConnection(connector.getPersistenceId(), connector.getConnectionForms(), framework.getConnectionForms());
    MConnectionForms forms = connection.getConnectorPart();
    forms.getStringInput("f.String").setValue("A");
    forms.getMapInput("f.Map").setValue(map);
    forms.getIntegerInput("f.Integer").setValue(1);
    forms.getBooleanInput("f.Boolean").setValue(true);
    forms.getEnumInput("f.Enum").setValue("YES");

    // Create the connection in repository
    handler.createConnection(connection, getDerbyConnection());
    assertNotSame(connection.getPersistenceId(), MPersistableEntity.PERSISTANCE_ID_DEFAULT);

    // Retrieve created connection
    MConnection retrieved = handler.findConnection(connection.getPersistenceId(), getDerbyConnection());
    forms = retrieved.getConnectorPart();
    assertEquals("A", forms.getStringInput("f.String").getValue());
    assertEquals(map, forms.getMapInput("f.Map").getValue());
    assertEquals(1, (int)forms.getIntegerInput("f.Integer").getValue());
    assertEquals(true, (boolean)forms.getBooleanInput("f.Boolean").getValue());
    assertEquals("YES", forms.getEnumInput("f.Enum").getValue());
  }
View Full Code Here


    jobForms.add(new MJobForms(MJob.Type.EXPORT, getForms()));
    return jobForms;
  }

  protected MConnectionForms getConnectionForms() {
    return new MConnectionForms(getForms());
  }
View Full Code Here

        long connectionID = connection.getPersistenceId();
        // Make a new copy of the forms from the connector,
        // else the values will get set in the forms in the connector for
        // each connection.
        List<MForm> forms = newConnector.getConnectionForms().clone(false).getForms();
        MConnectionForms newConnectionForms = new MConnectionForms(forms);
        upgrader.upgrade(connection.getConnectorPart(), newConnectionForms);
        MConnection newConnection = new MConnection(connectorID,
          newConnectionForms, connection.getFrameworkPart());
        newConnection.setPersistenceId(connectionID);
View Full Code Here

        long connectionID = connection.getPersistenceId();
        // Make a new copy of the forms from the connector,
        // else the values will get set in the forms in the connector for
        // each connection.
        List<MForm> forms = framework.getConnectionForms().clone(false).getForms();
        MConnectionForms newConnectionForms = new MConnectionForms(forms);
        upgrader.upgrade(connection.getFrameworkPart(), newConnectionForms);
        MConnection newConnection = new MConnection(connection.getConnectorId(),
          connection.getConnectorPart(), newConnectionForms);
        newConnection.setPersistenceId(connectionID);
View Full Code Here

    }

    MConnection connection = connections.get(0);

    // Verify that user is not trying to spoof us
    MConnectionForms connectorForms =
      ConnectorManager.getInstance().getConnectorMetadata(connection.getConnectorId())
      .getConnectionForms();
    MConnectionForms frameworkForms = FrameworkManager.getInstance().getFramework()
      .getConnectionForms();

    if(!connectorForms.equals(connection.getConnectorPart())
      || !frameworkForms.equals(connection.getFrameworkPart())) {
      throw new SqoopException(ServerError.SERVER_0003,
        "Detected incorrect form structure");
    }

    // Responsible connector for this session
View Full Code Here

  private MConnector connector(long id, String version) {
    List<MJobForms> jobForms = new LinkedList<MJobForms>();
    jobForms.add(new MJobForms(MJob.Type.IMPORT, FormUtils.toForms(ImportJobConfiguration.class)));

    MConnector connector = new MConnector("A" + id, "A" + id, version + id,
        new MConnectionForms(new LinkedList<MForm>()), jobForms);
    connector.setPersistenceId(id);
    return connector;
  }
View Full Code Here

  private MFramework framework() {
    List<MJobForms> jobForms = new LinkedList<MJobForms>();
    jobForms.add(new MJobForms(MJob.Type.IMPORT, FormUtils.toForms(ImportJobConfiguration.class)));

    MFramework framework = new MFramework(new MConnectionForms(new LinkedList<MForm>()),
      jobForms, FrameworkManager.CURRENT_FRAMEWORK_VERSION);
    framework.setPersistenceId(1);
    return framework;
  }
View Full Code Here

    framework.setPersistenceId(1);
    return framework;
  }

  private MConnection connection(long id, long cid) {
    MConnection connection = new MConnection(cid, new MConnectionForms(new LinkedList<MForm>()),
        new MConnectionForms(new LinkedList<MForm>()));
    connection.setPersistenceId(id);
    return connection;
  }
View Full Code Here

        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);
View Full Code Here

      // Return nothing If there aren't any framework metadata
      if(connectionForms.isEmpty() && jobForms.isEmpty()) {
        return null;
      }

      mf = new MFramework(new MConnectionForms(connectionForms),
        convertToJobList(jobForms), detectFrameworkVersion(conn));

      // We're using hardcoded value for framework metadata as they are
      // represented as NULL in the database.
      mf.setPersistenceId(1);
View Full Code Here

TOP

Related Classes of org.apache.sqoop.model.MConnectionForms

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.