common/src/main/java/gr/ntua/ece/cslab/selis/bda/common/storage/connectors/HBaseConnector.java
public static String createNamespace(String fs, String username, String password, Configuration configuration,
                                         String dbname) throws IOException, ServiceException {
        // Initialize HBase Configuration.
        org.apache.hadoop.conf.Configuration localHbaseConfiguration = HBaseConnector.createHBaseConfiguration(
            fs, configuration);

        // Check HBase Availability.
        try {
            HBaseAdmin.checkHBaseAvailable(localHbaseConfiguration);
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, "HBase Availability Check Failed.");
            throw e;
        }

        // Initialize HBase Connection.
        Admin admin;
        try {
            admin = ConnectionFactory.createConnection(localHbaseConfiguration).getAdmin();
        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, "Admin Connection Failed! Check output console.");
            throw e;
        }

        LOGGER.log(Level.INFO, "HBase connection initialized.");

        // Create HBase namespace
        try {
            admin.createNamespace(NamespaceDescriptor.create(dbname).build());
        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, "Creation of namespace failed! Check output console.");
            throw e;
        }

        LOGGER.log(Level.INFO, "HBase namespace created.");

        try {
            TableName tableName = TableName.valueOf(dbname + ":Events");
            HTableDescriptor desc = new HTableDescriptor(tableName);
            desc.addFamily(new HColumnDescriptor("messages"));

            admin.createTable(desc);
            admin.close();
        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, "Creation of Events table in namespace failed! Check output console.");
            throw e;
        }

        LOGGER.log(Level.INFO, "HBase namespace created.");

        return fs + dbname;
    }
/**
     * Creates a new Namespace for the given SCN at the EventLog database.
     *
     * Based on the given `dbname` creates a new Namespace with the name `dbname + ":Events"`.
     *
     * @param fs            The URL of the SCN's EventLog database.
     * @param username      The username to connect to the EventLog database.
     * @param password      The password to connect to the EventLog database.
     * @param configuration The Global BDA configuration.
     * @param dbname        The name of the new Namespace to create.
     * @return              A String with the full path to the Namespace (including server URL).
     * @throws IOException
     * @throws ServiceException
     */
Creates a new Namespace for the given SCN at the EventLog database.
Based on the given `dbname` creates a new Namespace with the name `dbname + ":Events"`.

@param fs            The URL of the SCN's EventLog database.
@param username      The username to connect to the EventLog database.
@param password      The password to connect to the EventLog database.
@param configuration The Global BDA configuration.
@param dbname        The name of the new Namespace to create.
@return              A String with the full path to the Namespace (including server URL).
Creates a new Namespace for the given SCN at the EventLog database . Based on the given ` dbname ` creates a new Namespace with the name ` dbname + " : Events " ` . @param fs The URL of the SCN ' s EventLog database . @param username The username to connect to the EventLog database . @param password The password to connect to the EventLog database . @param configuration The Global BDA configuration . @param dbname The name of the new Namespace to create . @return A String with the full path to the Namespace ( including server URL ) .
public static String createNamespace(String fs, String username, String password, Configuration configuration,
                                         String dbname) throws IOException, ServiceException {
        org.apache.hadoop.conf.Configuration localHbaseConfiguration = HBaseConnector.createHBaseConfiguration(
            fs, configuration);
        try {
            HBaseAdmin.checkHBaseAvailable(localHbaseConfiguration);
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, "HBase Availability Check Failed.");
            throw e;
        }
        Admin admin;
        try {
            admin = ConnectionFactory.createConnection(localHbaseConfiguration).getAdmin();
        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, "Admin Connection Failed! Check output console.");
            throw e;
        }
        LOGGER.log(Level.INFO, "HBase connection initialized.");
        try {
            admin.createNamespace(NamespaceDescriptor.create(dbname).build());
        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, "Creation of namespace failed! Check output console.");
            throw e;
        }
        LOGGER.log(Level.INFO, "HBase namespace created.");
        try {
            TableName tableName = TableName.valueOf(dbname + ":Events");
            HTableDescriptor desc = new HTableDescriptor(tableName);
            desc.addFamily(new HColumnDescriptor("messages"));
            admin.createTable(desc);
            admin.close();
        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, "Creation of Events table in namespace failed! Check output console.");
            throw e;
        }
        LOGGER.log(Level.INFO, "HBase namespace created.");
        return fs + dbname;
    }
public static String createNamespace ( String fs , String username , String password , Configuration configuration , String dbname ) throws IOException , ServiceException { org . apache . hadoop . conf . Configuration localHbaseConfiguration = HBaseConnector . createHBaseConfiguration ( fs , configuration ) ; try { HBaseAdmin . checkHBaseAvailable ( localHbaseConfiguration ) ; } catch ( Exception e ) { LOGGER . log ( Level . SEVERE , "HBase Availability Check Failed." ) ; throw e ; } Admin admin ; try { admin = ConnectionFactory . createConnection ( localHbaseConfiguration ) . getAdmin ( ) ; } catch ( IOException e ) { LOGGER . log ( Level . SEVERE , "Admin Connection Failed! Check output console." ) ; throw e ; } LOGGER . log ( Level . INFO , "HBase connection initialized." ) ; try { admin . createNamespace ( NamespaceDescriptor . create ( dbname ) . build ( ) ) ; } catch ( IOException e ) { LOGGER . log ( Level . SEVERE , "Creation of namespace failed! Check output console." ) ; throw e ; } LOGGER . log ( Level . INFO , "HBase namespace created." ) ; try { TableName tableName = TableName . valueOf ( dbname + ":Events" ) ; HTableDescriptor desc = new HTableDescriptor ( tableName ) ; desc . addFamily ( new HColumnDescriptor ( "messages" ) ) ; admin . createTable ( desc ) ; admin . close ( ) ; } catch ( IOException e ) { LOGGER . log ( Level . SEVERE , "Creation of Events table in namespace failed! Check output console." ) ; throw e ; } LOGGER . log ( Level . INFO , "HBase namespace created." ) ; return fs + dbname ; }
Creates a new Namespace for the given SCN at the EventLog database.
Creates a new Namespace for the given SCN at the EventLog database .
// Initialize HBase Configuration. // Check HBase Availability. // Initialize HBase Connection. // Create HBase namespace