Package com.netflix.staash.rest.meta.entity

Examples of com.netflix.staash.rest.meta.entity.PaasTableEntity$Builder


        } catch (AlreadyExistsException e) {
            // It's ok, ignore
        }
        if (entity instanceof PaasTableEntity) {
            // first create/check if schema db exists
            PaasTableEntity tableEnt = (PaasTableEntity) entity;
            String schemaName = tableEnt.getSchemaName();
            String storage = tableEnt.getStorage();
            try {
//                String payLoad = tableEnt.getPayLoad();
                if (storage!=null && storage.contains("mysql")) {
                    MySqlService.createDbInMySql(schemaName);
                } //else {
                session.execute(String.format(
                        PaasUtils.CREATE_KEYSPACE_SIMPLE_FORMAT, schemaName, 1));
                //}//create counterpart in cassandra
            } catch (AlreadyExistsException e) {
                // It's ok, ignore
            }
            // if schema/db already exists now create the table
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            String query = BuildQuery(tableEnt);
            Print(query);
            if (storage!=null && storage.contains("mysql")) {
               MySqlService.createTableInDb(schemaName, query);
            } else {
                storage="cassandra";
                session.execute(query);
            }
            List<String> tables = dbToTableMap.get(tableEnt.getSchemaName());
            if (tables==null) tables = new ArrayList<String>();
            tables.add(tableEnt.getName());
            tableToStorageMap.put(tableEnt.getName(), storage);
            // List<String> primaryKeys = entity.getPrimaryKey();
        }
        if (entity instanceof PaasTimeseriesEntity) {
            // first create/check if schema db exists
            PaasTimeseriesEntity tableEnt = (PaasTimeseriesEntity) entity;
            try {
                String schemaName = tableEnt.getSchemaName();
                session.execute(String.format(
                        PaasUtils.CREATE_KEYSPACE_SIMPLE_FORMAT, schemaName, 1));
            } catch (AlreadyExistsException e) {
                // It's ok, ignore
            }
            // if schema/db already exists now create the table
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            String query = BuildQuery(tableEnt);
            Print(query);
            session.execute(query);
            List<String> tables = dbToTimeseriesMap.get(tableEnt.getSchemaName());
            if (tables==null) tables = new ArrayList<String>();
            tables.add(tableEnt.getName().substring(tableEnt.getName().indexOf(".")+1));
            // List<String> primaryKeys = entity.getPrimaryKey();
        }
        JsonObject obj = new JsonObject("{\"status\":\"ok\"}");
        return obj.toString();
    }
View Full Code Here


                 String retdb = meta.writeMetaEntity(pdbe);
                cache.addEntityToCache(EntityType.DB, pdbe);
                return retdb;
            case TABLE:
                String schema = new JsonObject(payload).getString("db");
                PaasTableEntity pte = PaasTableEntity.builder()
                        .withJsonPayLoad(new JsonObject(payload), schema)
                        .build();
                createDBTable(pte.getPayLoad());
                String rettbl =  meta.writeMetaEntity(pte);
                cache.addEntityToCache(EntityType.TABLE, pte);
                return rettbl;
            case SERIES:
                String tsschema = new JsonObject(payload).getString("db");
View Full Code Here

TOP

Related Classes of com.netflix.staash.rest.meta.entity.PaasTableEntity$Builder

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.