Package org.apache.sqoop.json

Examples of org.apache.sqoop.json.ConnectionBean


    return validationBean;
  }

  public ValidationBean update(String serverUrl, MConnection connection) {

    ConnectionBean connectionBean = new ConnectionBean(connection);
    JSONObject connectionJson = connectionBean.extract();

    String response = super.put(serverUrl + RESOURCE
                                  + connection.getPersistenceId(),
                                connectionJson.toJSONString());
View Full Code Here


    io.out.println(MessageFormat.format(getResource().getString(Constants
        .RES_UPDATE_UPDATING_CONN), connectionId));

    ConsoleReader reader = new ConsoleReader();

    ConnectionBean connectionBean = readConnection(connectionId);

    // TODO(jarcec): Check that we have expected data
    MConnection connection = connectionBean.getConnections().get(0);
    ResourceBundle frameworkBundle
      = connectionBean.getFrameworkBundle();
    ResourceBundle connectorBundle
      = connectionBean.getConnectorBundle(connection.getConnectorId());

    Status status = Status.FINE;

    io.out.println(getResource().getString(Constants
        .RES_PROMPT_UPDATE_CONN_METADATA));
View Full Code Here

    return null;
  }

  private void showConnection(String xid) {
    ConnectionBean connectionBean = readConnection(xid);

    List<MConnection> connections = connectionBean.getConnections();

    String s = MessageFormat.format(getResource().getString(Constants
        .RES_SHOW_PROMPT_CONNS_TO_SHOW), connections.size());

    io.out.println(s);

    for (MConnection connection : connections) {
      s =  MessageFormat.format(getResource().getString
          (Constants.RES_SHOW_PROMPT_CONN_INFO), connection.getPersistenceId(),
          connection.getName());
      io.out.println(s);

      long connectorId = connection.getConnectorId();

      // Display connector part
      displayForms(io,
                   connection.getConnectorPart().getForms(),
                   connectionBean.getConnectorBundle(connectorId));
      displayForms(io,
                   connection.getFrameworkPart().getForms(),
                   connectionBean.getFrameworkBundle());
    }
  }
View Full Code Here

        .RES_CREATE_CREATING_JOB), connectionId));

    ConsoleReader reader = new ConsoleReader();

    FrameworkBean frameworkBean = readFramework();
    ConnectionBean connectionBean = readConnection(connectionId);
    ConnectorBean connectorBean;

    MFramework framework = frameworkBean.getFramework();
    ResourceBundle frameworkBundle = frameworkBean.getResourceBundle();

    MConnection connection = connectionBean.getConnections().get(0);

    connectorBean = readConnector(String.valueOf(connection.getConnectorId()));
    MConnector connector = connectorBean.getConnectors().get(0);
    ResourceBundle connectorBundle = connectorBean.getResourceBundles().get(connector.getPersistenceId());
View Full Code Here

  private JsonBean createUpdateConnection(RequestContext ctx, boolean update) {
//    Check that given ID equals with sent ID, otherwise report an error UPDATE
//    String sxid = ctx.getLastURLElement();
//    long xid = Long.valueOf(sxid);

    ConnectionBean bean = new ConnectionBean();

    try {
      JSONObject json =
        (JSONObject) JSONValue.parse(ctx.getRequest().getReader());
      bean.restore(json);
    } catch (IOException e) {
      throw new SqoopException(ServerError.SERVER_0003,
        "Can't read request content", e);
    }

    // Get connection object
    List<MConnection> connections = bean.getConnections();

    if(connections.size() != 1) {
      throw new SqoopException(ServerError.SERVER_0003,
        "Expected one connection metadata but got " + connections.size());
    }
View Full Code Here

    return outputBean;
  }

  private JsonBean getConnections(RequestContext ctx) {
    String sxid = ctx.getLastURLElement();
    ConnectionBean bean;

    Locale locale = ctx.getAcceptLanguageHeader();
    Repository repository = RepositoryManager.getInstance().getRepository();

    if (sxid.equals("all")) {

      List<MConnection> connections = repository.findConnections();
      bean = new ConnectionBean(connections);

      // Add associated resources into the bean
      for( MConnection connection : connections) {
        long connectorId = connection.getConnectorId();
        if(!bean.hasConnectorBundle(connectorId)) {
          bean.addConnectorBundle(connectorId,
            ConnectorManager.getInstance().getResourceBundle(connectorId, locale));
        }
      }
    } else {
      long xid = Long.valueOf(sxid);

      MConnection connection = repository.findConnection(xid);
      long connectorId = connection.getConnectorId();

      bean = new ConnectionBean(connection);

      bean.addConnectorBundle(connectorId,
        ConnectorManager.getInstance().getResourceBundle(connectorId, locale));
    }

    // Sent framework resource bundle in all cases
    bean.setFrameworkBundle(FrameworkManager.getInstance().getBundle(locale));

    return bean;
  }
View Full Code Here

    } else {
      response = super.get(serverUrl + RESOURCE + xid);
    }
    JSONObject jsonObject = (JSONObject)JSONValue.parse(response);

    ConnectionBean connectionBean = new ConnectionBean();
    connectionBean.restore(jsonObject);

    return connectionBean;
  }
View Full Code Here

    return connectionBean;
  }

  public ValidationBean create(String serverUrl, MConnection connection) {

    ConnectionBean connectionBean = new ConnectionBean(connection);

    // Extract all form inputs including sensitive inputs
    JSONObject connectionJson = connectionBean.extract(false);

    String response = super.post(serverUrl + RESOURCE,
                                 connectionJson.toJSONString());

    ValidationBean validationBean = new ValidationBean();
View Full Code Here

    return validationBean;
  }

  public ValidationBean update(String serverUrl, MConnection connection) {

    ConnectionBean connectionBean = new ConnectionBean(connection);

    // Extract all form inputs including sensitive inputs
    JSONObject connectionJson = connectionBean.extract(false);

    String response = super.put(serverUrl + RESOURCE
                                  + connection.getPersistenceId(),
                                connectionJson.toJSONString());
View Full Code Here

TOP

Related Classes of org.apache.sqoop.json.ConnectionBean

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.