Package co.nubetech.crux.model

Examples of co.nubetech.crux.model.Connection


  public void destroyObject(Object key, Object obj) throws Exception {
    // Not sure it works or not.

    Client client = (Client) key;
    Cluster cluster = client.getCluster();
    Connection conn = (Connection) obj;

    String hbaseRestServerPropertyValue = conn.getProperties()
        .get(CruxConstants.HBASE_ZOOKEEPER_PROPERTY).getValue();
    String[] hbaseRestServerPropertyValueArray = hbaseRestServerPropertyValue
        .split(",");
    logger.debug("hbaseRestServerPropertyValueArray.length is: "
        + hbaseRestServerPropertyValueArray.length);
View Full Code Here


    }
  }

  @Override
  public Object makeObject(Object obj) {
    Connection connection = (Connection) obj;
    Cluster cluster = getCluster(connection);
    Client client = new Client(cluster);
    return client;
  }
View Full Code Here

    ServletContext servletContext = ServletActionContext
        .getServletContext();
    HBaseConnectionPool pool = (HBaseConnectionPool) servletContext
        .getAttribute(CruxConstants.HBASE_POOL);

    Connection connectionToTest = new Connection();
    ConnectionProperty property = new ConnectionProperty();
    property.setProperty(CruxConstants.HBASE_ZOOKEEPER_PROPERTY);
    property.setValue(hbaseRestServerPropertyValue);
    connectionToTest.addProperty(property);

    try {
      HBaseFacade hbaseFacade = getHBaseFacade();
      boolean isValidConnection = hbaseFacade
          .isValidConnection(connectionToTest);
      logger.debug("isValidConnection : " + isValidConnection);
      if (isValidConnection) {
        connection = connectionDAO.findById(connection.getId());
        Connection connectionToUpdate = connection;
        connection.setName(connectionName);
        hbaseRestServerProperty = connection.getProperties().get(
            CruxConstants.HBASE_ZOOKEEPER_PROPERTY);
        hbaseRestServerProperty.setValue(hbaseRestServerPropertyValue);
View Full Code Here

  public List<ArrayList<Cell>> getData(Report report, Mapping mapping) {
    List<ArrayList<Cell>> dataList = new ArrayList<ArrayList<Cell>>();
    CruxScanner cruxScanner = null;
    try {
      Connection conn = mapping.getConnection();
      HBaseFacade hbaseFacade = this.getHBaseFacade();

      logger.debug("About to get data for Report:" + report);
      cruxScanner = hbaseFacade.execute(conn, report, mapping);
      logger.debug("Data fetched from HBaseFacade");
View Full Code Here

    Datastore datastore = new Datastore();
    datastore.setId(121212);
    datastore.setName("Hbase");

    //connection
    Connection connection = new Connection();
    ConnectionProperty connectionProperty1 = new ConnectionProperty(connection, CruxConstants.HBASE_ZOOKEEPER_PROPERTY,"value1");
    ConnectionProperty connectionProperty2 = new ConnectionProperty(connection, CruxConstants.HBASE_ZOOKEEPER_PROPERTY,"value2");
    connection.addProperty(connectionProperty1);
    connection.addProperty(connectionProperty2);
    connection.setDatastore(datastore);
    connection.setUser(user);
    connection.setId(1);
    connection.setName("ConnectionName1")
   
    Map<String, ColumnAlias> columnAliasMap = null;
    SortedMap<String, RowAlias> rowAliasMap = null;
   
   
View Full Code Here

    ConnectionDAO connectionDAO = new ConnectionDAO();
    try {
    connectionDAO.session = com.googlecode.s2hibernate.struts2.plugin.util.HibernateSessionFactory
        .getNewSession();
    Connection connection = connectionDAO.findById(99999l);
    ConnectionProperty connectionProperty = connection.getProperties().get(
        "propertyTest");
    assertEquals(connectionProperty.getValue(), "valueTest");

    connectionProperty.setValue("updateValueTest");
View Full Code Here

    ConnectionDAO connectionDAO = new ConnectionDAO();
    try {
    connectionDAO.session = com.googlecode.s2hibernate.struts2.plugin.util.HibernateSessionFactory
        .getNewSession();
    Connection connection = connectionDAO.findById(99999l);
    ConnectionProperty connectionProperty = connection.getProperties().get(
        "propertyTest");
    assertEquals(connectionProperty.getValue(), "valueTest");

    connectionProperty.setValue("updateValueTest");
View Full Code Here

    connectionDAO.session = com.googlecode.s2hibernate.struts2.plugin.util.HibernateSessionFactory
        .getNewSession();
    connectionDAO.transaction = connectionDAO.session.getTransaction();
    // connectionDAO.transaction.begin();

    Connection connection = connectionDAO.findById(99999l);
    connection.setName("updateConnection");
    connectionDAO.save(connection);
    // connectionDAO.transaction.commit();

    ResultSet rsOfConnection = stmt
        .executeQuery("select name from connection where id=" + 99999);
View Full Code Here

    ConnectionPropertyDAO hostPropertyDAO = new ConnectionPropertyDAO();
    hostPropertyDAO.session = com.googlecode.s2hibernate.struts2.plugin.util.HibernateSessionFactory
        .getNewSession();

    Connection connection = connectionDAO.findById(99999l);
    connection.setName("updateConnection");

    ConnectionProperty connectionProperty = connection.getProperties().get(
        "propertyTest");
    assertEquals(connectionProperty.getValue(), "valueTest");

    connectionProperty.setValue("updateValueTest");
View Full Code Here

    ConnectionDAO connectionDAO = new ConnectionDAO();
    try {
    connectionDAO.session = com.googlecode.s2hibernate.struts2.plugin.util.HibernateSessionFactory
        .getNewSession();

    Connection resultConn = connectionDAO.findById(99999l);
    assertEquals(resultConn.getName(), "connectionTest");
    assertEquals(resultConn.getDatastore().getId(), 1l);
    assertEquals(resultConn.getUser().getId(), 1l);

    Map<String, ConnectionProperty> properties = resultConn.getProperties();
    ConnectionProperty connPorperty = properties.get("propertyTest");

    assertEquals(connPorperty.getId(), 99999l);
    assertEquals(connPorperty.getConnection().getId(), 99999l);
    assertEquals(connPorperty.getProperty(), "propertyTest");
View Full Code Here

TOP

Related Classes of co.nubetech.crux.model.Connection

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.